-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement Redis-backed priority queue system
This commit introduces Redis as the backend storage system for the task queue manager and implements priority-based task processing. Key changes include: Core Features: - Add Redis integration for persistent task storage - Implement priority queue system with sorted sets - Add task status tracking and state management - Add worker pool management with configurable concurrency Technical Details: - Use Redis ZADD with priority scores for task ordering - Implement atomic task state transitions - Add task metadata storage with expiration - Add circuit breaker pattern for error handling - Add graceful shutdown with task completion waiting Testing: - Add integration tests for priority ordering - Add tests for concurrent task processing - Add tests for error handling and recovery - Add cleanup and shutdown tests Documentation: - Update README with Redis configuration - Add API documentation for new features - Add usage examples for priority queues - Add configuration guidelines Breaking Changes: - Requires Redis server (>= 5.0) - Changed task submission API to include priorities - Changed queue configuration format This change provides a robust foundation for distributed task processing with proper priority handling and persistent state management.
- Loading branch information
Showing
8 changed files
with
645 additions
and
378 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
# kew/tests/conftest.py | ||
import pytest | ||
import asyncio | ||
from kew import TaskQueueManager | ||
|
||
@pytest.fixture | ||
async def manager(): | ||
"""Fixture that provides a TaskQueueManager instance""" | ||
manager = TaskQueueManager() | ||
yield manager | ||
await manager.shutdown() | ||
@pytest.fixture(scope="session") | ||
def event_loop(): | ||
"""Create an instance of the default event loop for each test case.""" | ||
policy = asyncio.get_event_loop_policy() | ||
loop = policy.new_event_loop() | ||
yield loop | ||
loop.close() | ||
|
||
@pytest.fixture(scope="session") | ||
def anyio_backend(): | ||
"""Backend for anyio/pytest-asyncio.""" | ||
return 'asyncio' |
Oops, something went wrong.