Skip to content

Wait#34

Merged
Suke0811 merged 6 commits intomainfrom
wait
Aug 9, 2025
Merged

Wait#34
Suke0811 merged 6 commits intomainfrom
wait

Conversation

@Suke0811
Copy link
Copy Markdown
Owner

@Suke0811 Suke0811 commented Aug 9, 2025

This pull request updates the wait parameter behavior for the spin decorator, context manager, and related rate control utilities to make non-blocking execution the default for both async and threaded sync functions. It also improves documentation and test coverage to reflect these changes, ensuring clearer and more predictable blocking semantics for users.

Core API changes:

  • Changed the default value of the wait parameter to False in the spin decorator, context manager, and related methods, making fire-and-forget (non-blocking) the default for async and threaded sync functions. Blocking execution now requires explicitly passing wait=True. [1] [2] [3] [4] [5]
  • Updated the implementation of RateControl.start_spinning_sync and RateControl.start_spinning_async_wrapper to correctly handle the new wait semantics, including proper thread joining and task awaiting when wait=True. [1] [2] [3] [4]

Documentation updates:

  • Revised the cheatsheet and docstrings to clarify the new default behavior for the wait parameter and explain blocking/non-blocking modes for both async and sync threaded functions. [1] [2] [3]

Test improvements:

  • Updated existing tests to explicitly pass wait=True where blocking behavior is required, and added new tests to verify correct blocking and thread joining for both decorator and direct usage of threaded sync functions. [1] [2] [3] [4] [5] [6] [7]

Other enhancements:

  • Added a default timeout to all pytest tests to prevent infinite hangs, improving CI reliability and developer experience.

Internal codebase changes:

  • Minor refactoring and comments to support the new keyword-only wait parameter and ensure backward compatibility. [1] [2]

@Suke0811 Suke0811 requested a review from Copilot August 9, 2025 03:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request changes the default behavior of the wait parameter from True to False across the fspin library, making fire-and-forget (non-blocking) execution the default for both async and threaded sync functions. This is a breaking change that affects the spin decorator, context manager, and related rate control utilities.

Key changes:

  • Changed default wait parameter to False for non-blocking execution by default
  • Updated documentation and examples to reflect the new default behavior
  • Added comprehensive test coverage for thread joining and blocking behavior
  • Enhanced test infrastructure with timeout enforcement to prevent infinite hangs

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
fspin/decorators.py Updates spin decorator to use wait=False default and handle thread joining logic
fspin/spin_context.py Changes context manager to accept and forward wait parameter with new default
fspin/rate_control.py Implements thread joining logic when wait=True and updates async wrapper default
fspin_cheatsheet.md Updates documentation to reflect new default wait=False behavior
tests/*.py Adds new tests for blocking behavior and updates existing tests to explicitly use wait=True
pytest.ini Adds timeout configuration to prevent infinite test hangs
example/*.py Updates examples to explicitly specify wait=True for blocking behavior

Suke0811 and others added 2 commits August 8, 2025 20:32
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Suke0811 Suke0811 merged commit 4f93711 into main Aug 9, 2025
7 checks passed
@Suke0811 Suke0811 deleted the wait branch October 9, 2025 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants