Merged
Conversation
…ush, fix shutdown lock - Extract _merge_actions() helper to deduplicate action-merging logic in add() - Replace hand-rolled snapshot in _delayed_flush with _prepare_flush() call - Move cancelled task await outside lock in shutdown() to prevent potential deadlock
…v2/action_queue_improvements
… efficiency; add tests for ActionQueueSettings validation and handling of empty actions.
…ing logic for device actions
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the action queue batching implementation to reduce duplication, clarifies queue behavior in docs, and adds tests to cover validation and edge cases around flushing/cancellation.
Changes:
- Refactor action merging into a shared helper and simplify batch execution unpacking.
- Adjust delayed-flush / shutdown flow to avoid self-cancellation and reduce lock-held awaits.
- Add tests for settings validation, empty add/flush/shutdown behavior, and cancellation propagation; expand action-queue documentation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
pyoverkiz/action_queue.py |
Refactors action merging and adjusts delayed flush/shutdown logic; expands class docstring explanation. |
tests/test_action_queue.py |
Adds new tests covering settings validation, empty inputs, cancellation propagation, and delayed-flush self-cancel regression. |
docs/action-queue.md |
Adds detailed explanation and examples of batching/merging behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+21
to
+23
| await client.execute_action_group([Action("io://1234-5678-1234/12345678", [Command(name=OverkizCommand.CLOSE)])]) | ||
| await client.execute_action_group([Action("io://1234-5678-1234/87654321", [Command(name=OverkizCommand.OPEN)])]) | ||
| await client.execute_action_group([Action("io://1234-5678-1234/11111111", [Command(name=OverkizCommand.STOP)])]) |
There was a problem hiding this comment.
This example constructs Action positionally (Action("io://...", [...])), but pyoverkiz.models.Action is kw_only=True, so positional args will raise TypeError. Update to Action(device_url=..., commands=[...]).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.