-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
bot: keep track of trigger processing threads #1732
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting. As long as it won't lead to any appreciable performance decrease, I see no reason not to keep track of stuff for testing and debugging purposes.
My guess is that looping through the list of running triggers will be quite fast, so it's not really a concern. That list should never get anywhere near a large enough size to cause lock contention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fat-fingered the "Approve" button, when clearly my previous review was requesting changes. To everyone watching this repo: Sorry for the double email!
3311f73
to
de806d6
Compare
I rebased to fix the conflict, but I'll wait until #1728 is merged before fixing the remaining issues. |
157c5e5
to
73c6312
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like I missed a few things in my last review. But I guess it's OK, because it means I can try to sneak in a log format change since you're touching that line anyway. 😝
All fixed (again). Waiting for a go to squash. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Exirel I reviewed the commits addressing my comments. Go for squash!
Co-Authored-By: dgw <[email protected]>
aeed057
to
4396dcf
Compare
Done. |
Based on #1728 to avoid future merge conflict.
My initial idea was to join trigger processing threads directly in the
dispatch
method. For several reasons (including the echo-message polyfill), that's not doable.Instead, since all I want is a way to know, access, and join processing threads in automated tests, I make sure the bot keeps track of its threads. This way, I'll be able to run a dispatch, going through all the bot's internals and machineries, and then wait for the end result in my tests.
It was a bit convoluted, but in the end I think it turned out great!
Quick note about memory consumption: this information generate a very low overhead, since running threads are kept in memory anyway by Python. All that is stored is a reference to the thread object, and every time dispatch is called, the list is flushed out of obsolete running threads.