question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider adaptation via IOLoop interface for 1.0.0

See original GitHub issue

I created this issue to bounce an idea off the maintainer community.

Presently in pika’s async world (e.g. SelectConnection, Tornado connection, AsyncioConnection) various APIs that normally belong in ioloops appear to be misplaced in connection adapter classes. Those are the likes of add timeout, remove timeout, etc. Those APIs traditionally belong in the ioloop, and I think it would be cleaner to remove them from the connection adapters and only expose them from the ioloop adapters of the specific ioloop adaptations.

Furthermore, on a related note, these async connection adapters are presently implemented via a (somewhat arbitrary) combination of subclassing BaseConnection and overriding some of its (and possibly Connection’s) members and a native ioloop wrapper. I think it would be cleaner to define an abstract ioloop interface as the primary means of adaptation which makes it very clear what needs to be implemented. This way, there would be no need for TornadoConnection, etc. An app could simply instantiate a generic pika-provided async connection class (e.g., pika.AsyncConnection) passing its constructor the specific ioloop adapter instance (e.g., pika.TornadoIOLoopAdapter()). Having a well-defined abstract IOLoop adapter interface as the primary means for adaptation should improve stability of the adaptations by eliminating the guess-work of what needs to be overridden and reducing code paths that need to be tested, thus better leveraging common/shared test code. That said, adaptations could still provide specific Connection classes as needed, for example to extend the API with some native ioloop features such as futures.

I realize that pika already has the major ioloop adaptations covered, so this proposal is largely for cleaning up the API and existing integrations.

Your thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
vitaly-kruglcommented, Mar 7, 2018

I am hoping to get the apps away from accessing the connection’s internal ioloop, which is often an adapter on top of the native I/O loop. I would not want them to depend on any connection.ioloop API (that’s should really be just for the benefit of adapter implementations), calling it’s start/stop method, etc. (it shouldn’t be even providing a start() and stop() methods). Instead, apps should be interacting directly with the native I/O loop - calling the native loop’s start(), run_forever(), stop(), add_timeout(), etc.

1reaction
gmrcommented, Feb 21, 2018

Just dropping a note to let you know I’ve seen this and am digesting it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

tornado.ioloop — Main event loop
An I/O event loop for non-blocking sockets. In Tornado 6.0, IOLoop is a wrapper around the asyncio event loop, with a slightly different...
Read more >
7.4 Release Notes Red Hat Enterprise Linux 7
The Release Notes provide high-level coverage of the improvements and additions that have been implemented in Red Hat Enterprise Linux 7.4 and document ......
Read more >
debian/copyright ... - Apertis GitLab
Collection will not be considered an Adaptation for the purpose of. 263. this License. ... copies of the Work or Adaptation, as appropriate,...
Read more >
ChangeLog-SLE-15-SP3-GM-SLE-15-SP4-Snapshot ... - SUSE
Connections are made using HTTP/HTTPS depending on configuration, ... agent container - Update amazon-ecs.service to consider the proper environment files ...
Read more >
Packages beginning with letter P - RPMFind
pam_mysql-0.8.1-0.8.fc34, PAM module for auth UNIX users using MySQL data base ... passmenu-1.7.3-8.fc34, A dmenu based interface to pass. linux/noarch.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found