Skip to content

Conversation

@codcod
Copy link
Owner

@codcod codcod commented Jun 22, 2025

No description provided.

codcod added 14 commits June 22, 2025 06:48
- Replace fromJson(env.*) with direct matrix values in CI workflow
- Remove unused PYTHON_VERSIONS and OS_MATRIX environment variables
- Matrix now correctly uses inline values: python-version: ['3.12', '3.13'], os: ['ubuntu-latest']
- Fixes error: 'env' context is not available in matrix strategy
- Replace env.PRIMARY_PYTHON_VERSION with literal '3.13' in job name
- Job-level properties cannot access env context, only step-level can
- Fixes error: 'env' context not available in job name property
- Remove complex coverage combining that was failing with 'No data to combine'
- Use coverage report from Python 3.13 (primary version) directly
- Add condition to only run coverage-report when unit-tests succeed
- Simplify artifact download to use specific coverage file
- Remove unnecessary uv setup and dependency installation from coverage job

Fixes 'No data to combine' error in coverage-report step
- Add cache-dependency-glob: 'uv.lock' to all uv setup actions for consistent cache keys
- Remove redundant Python cache from lint job (uv's built-in cache is sufficient)
- Remove duplicate Codecov upload from coverage-report job
- Standardize caching across all jobs for better performance and consistency

Benefits:
- Faster CI runs with improved cache hit rates
- Consistent caching strategy across all jobs
- Reduced workflow complexity and duplication
- Add 'shell: bash' to the coverage test step in unit-tests job
- Fixes PowerShell parser error on Windows runners: 'Missing ( after if'
- Bash syntax [[ ]] requires bash shell, not PowerShell default on Windows
- Ensures cross-platform compatibility for conditional coverage logic
- Add signal handlers for SIGTERM and SIGINT
- Implement graceful client disconnection with unbind requests
- Add configurable shutdown timeout (default: 30s)
- New serve_forever() method for signal-based shutdown
- Enhanced context manager with graceful shutdown
- Add shutdown_requested property to check shutdown state
- Proper error handling during shutdown process

Benefits:
- Clients receive proper unbind notifications before disconnect
- Prevents data loss during server shutdown
- Improves overall system reliability and user experience
- Follows asyncio best practices for server lifecycle management
- New examples/graceful_server.py demonstrating graceful shutdown
- Shows proper signal handling with SIGTERM/SIGINT
- Includes event handlers for monitoring client lifecycle
- Demonstrates configurable shutdown timeout
- Provides clear logging to observe graceful disconnection process

Usage instructions and testing guidelines included in docstring.
- Add shutdown_in_progress flag to prevent multiple shutdown attempts
- Simplify signal handler to only set event, avoid creating tasks
- Improve serve_forever() to properly handle shutdown event
- Add better logging for shutdown process
- Change example port to 2776 to avoid conflicts

Fixes issue where multiple SIGTERM/SIGINT signals caused repeated shutdown attempts
@codcod codcod linked an issue Jun 22, 2025 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Jun 22, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@codcod codcod merged commit ced0147 into main Jun 23, 2025
28 checks passed
@codcod codcod deleted the 1-feat-graceful-shutdown branch June 23, 2025 14:00
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.

feat: Graceful shutdown

2 participants