Skip to content

Commit 50aa2bc

Browse files
committed
Update overview
1 parent ce3a816 commit 50aa2bc

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
## Overview
1919

20-
FluxQueue is a task queue for Python that gets out of your way. The Rust core makes the process fast with less overhead, least dependencies, and most importantly, less memory usage. Tasks are managed through Redis.
20+
FluxQueue is a task queue for Python that gets out of your way. Built on a multi-threaded Tokio runtime, FluxQueue delivers high throughput while maintaining low memory usage. The Rust core ensures minimal overhead and dependencies, making it an efficient solution for background task processing. Tasks are managed through Redis.
2121

2222
## Key Features
2323

@@ -90,16 +90,15 @@ from fluxqueue import FluxQueue, Context
9090
fluxqueue = FluxQueue()
9191

9292
@fluxqueue.task_with_context()
93-
def process_data(ctx: Context, data: str):
93+
def process_data_task(ctx: Context, data: str):
9494
# Access task metadata
9595
print(f"Task ID: {ctx.metadata.task_id}")
9696
print(f"Retry count: {ctx.metadata.retries}")
9797

98-
# Process the data
99-
process(data)
98+
process_data(data)
10099
```
101100

102-
You can also subclass `Context` to create custom contexts with domain-specific resources:
101+
You can also subclass `Context` to create custom contexts with domain-specific resources. This example shows how to create a `DbContext` that manages database connections efficiently by reusing them across tasks in the same worker thread:
103102

104103
```python
105104
from contextlib import asynccontextmanager
@@ -130,7 +129,7 @@ class DbContext(Context):
130129
raise
131130

132131
@fluxqueue.task_with_context()
133-
async def create_user(ctx: DbContext, email: str, username: str):
132+
async def create_user_task(ctx: DbContext, email: str, username: str):
134133
async with ctx.session_context() as db_session:
135134
user = User(email=email, username=username)
136135
db_session.add(user)
@@ -140,7 +139,7 @@ The context parameter is automatically injected by the worker and is not part of
140139

141140
```python
142141
# Just call with your regular arguments
143-
create_user("user@example.com", "johndoe")
142+
create_user_task("user@example.com", "johndoe")
144143
```
145144

146145
## Installing the worker

0 commit comments

Comments
 (0)