-
Notifications
You must be signed in to change notification settings - Fork 77
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
Cancel event sources earlier #634
base: main
Are you sure you want to change the base?
Conversation
This is an attempt to address ansible#633 but it's very ham-fisted.
49f75ff
to
3670e97
Compare
@sc68cal Would it make more sense if we write a function called cancel_all_sources which can be called when a shutdown is issued. We would have to store all the tasks in a global variable in addition to this and use that global variable in cancel_all_sources, we would have to check if the task is done before we call cancel on it.. This function can be added in the app.py file. We would also need a task.done check here |
Where would this new function be declared? The issue is that the coroutine for the
Generally, think global variables are harmful and should be avoided. It makes the code harder to follow. Plus, we'd have to use locks or flags from asyncio to coordinate access, which may not be worth doing.
I'm not sure what you mean here - because at least on the RabbitMQ plugin I've written, it has a coroutine that
I'm not sure why we would be checking for done here, because we are trying to cancel consuming from event sources, that are never |
Some of the tests create a @@ -1045,7 +1045,7 @@ async def test_36_multiple_rulesets_both_fired():
):
await run_rulesets(
event_log,
- [],
+ [ruleset_queues[1][0].sources[0]],
ruleset_queues,
dict(),
"playbooks/inventory.yml", but |
This also changes some of the behaviors of the end to end tests. I think it's because of the ordering of the messages and when the shutdown message is sent, but I'm not 100% sure.
|
tasks was a variable that contained the return from spawn_sources as well as the websocket feedback task. These are different things, and should not be passed into run_rulesets, since the feedback task is not an event source. tasks is now used as a list of all tasks, only for the asyncio.gather call
This is fixed by handling the feedback task differently in the |
Hi, Can I get some feedback on this pull request from the maintainers? I did a pretty deep dive on the internals of |
Quality Gate failedFailed conditions |
This is an attempt to address #633 but it's very ham-fisted.