-
Notifications
You must be signed in to change notification settings - Fork 111
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
Rf batched command #7252
base: maint
Are you sure you want to change the base?
Rf batched command #7252
Conversation
The definition of the class BatchedCommandError was moved to keep class definitions together in the source. The definition of the function _now was moved to keep functions together in the source.
This commit defines a context manager that handles increasing and decreasing the _active-attribute in BatchedCommand
This commit adds a lock to synchronise the execution of BatchedCommand.cleanup() with the executions of __call__ on BatchedCommand instances. That means that no instance is cleaned while executing a command, i.e. sending a request and waiting for a resppnse. The cost for that is that cleanup cannot run during execution of any BatchedCommand.__call__ and therefore no BatchedCommand.__init__ will terminate during this time, so creation of new instances can only happen if no BatchedCommand is currently executing.
This commit moves the update of BatchedCommand._active_last to the increased_active-context handler
This commit removes the global BatchedCommand cleanup-lock in favor of inidividual locks in the BatchedCommand instances. This prevents the instances from serializing external calls, but requires a synchronisation point that includes all existing instances, when a new instance is created. In addition this commit renames the global instance dictionary in order to reflect that it contains all instances that have a runner associated. Work in the next commits should contain: add a limit to the cleanup duration, use a WeakSet instead of a WeakDictionary for the global instance collection.
This commit changes the input to the locked_instances-context manager to a list. This ensures that the elements don't change during the execution of the context manager and that all locked elements can be unlocked.
Codecov ReportBase: 88.71% // Head: 88.53% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## maint #7252 +/- ##
==========================================
- Coverage 88.71% 88.53% -0.19%
==========================================
Files 326 326
Lines 44420 44426 +6
Branches 5919 0 -5919
==========================================
- Hits 39407 39332 -75
- Misses 4998 5094 +96
+ Partials 15 0 -15
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Hi @yarikoptic, I would appreciate your thoughts on this PR and the related issue #7251 |
Fixes #7251
This PR uses thread-locks to ensure thread-safe determination of whether a
BatchedCommand
instance is active or not.TODO: