Skip to content

Analyze additional places where there is timer handle churn #8613

Closed
@bdraco

Description

@bdraco
          > Yep, thinking about it more, this is part of the low-level API that most users shouldn't interact with. So, I guess we should be dealing with this limitation.

Other places that might be improved:

client_proto.py:read_timeout: We cancel and reschedule everytime data is received.

I think it might be worth doing. It fires far less often than websockets though. Need to do some more profiling with this one.

client_ws.py: Do we need to deal with _pong_response_cb too? Cancelled and rescheduled on each heartbeat send.

This is a rare case where its almost never rescheduled since we expect it to respond right away or be closed. Its probably not worth optimizing.

web_protocol.py:.keep_alive(): Should we cancel if the val is already the same and a handle already exists?

This one doesn't seem to get rescheduled frequently when I looked at the profile.

Maybe some issues in connector.py if there are many connections that are getting closed.

cleanup_closed could use some improvements. Something to investigate for sure.

Also, helpers.py:TimeoutHandle is only used once in client.py and seems like something that could be replaced by asyncio.timeout(). We'd need to use asyncio.Timeout.reschedule() in the resp.connection callback.

That looks like a good opportunity to cleanup there.

Originally posted by @bdraco in #8608 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions