-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature request]Support priorities #455
Comments
P.S. Another smartish approach would be having the |
Or just using 2 different class names maybe... To be honest, I'm not sure if it's really worth maintaining the library going forwards. Most of its use cases should be covered by asyncio in the near future (I think it may be called Supervisor), so I know I probably won't be using it after that point. If you want to make a PR though, I'll review it. |
I am up to implementing either naive approach (replacing |
Hmm, I'm looking at the code, and 2 classes seems like the most logical approach. Clear separation and flexible. We'd need to tweak the base class so we can maybe do something like this in the subclass:
While the original class will have From here, people could subclass and implement their own queue structures the same way. |
If we go with two classes, what (if anything) should be done about |
Yep, could do that, if it's even going to be useful for aiohttp. |
Over time, my use case for
aiojobs
got extended to require support for job priorities, i.e. it should be possible to pass a priority value toScheduler.spawn
method, and if not executed immediately, job should be placed into the pending queue at a position according to the specified priority.If possible performance impact of replacing
deque
(which is the structure behindasyncio.Queue
used byaiojobs
) withheapq
+list
(used byasyncio.PriorityQueue
) could be neglected, then I would suppose that implementing this feature request would be as simple as adding an optional priority parameter tospawn
method and switching toPriorityQueue
. Otherwise, a slightly more involved implementation would involve creating aScheduler
subclass tentatively namedPriorityScheduler
.My use case doesn't require support for priorities in
aiojobs.aiohttp
but I suspect that it may be desirable to implement that as well for the sake of completeness.The text was updated successfully, but these errors were encountered: