Skip to content

Commit fb26eaa

Browse files
committed
PyPI package.
1 parent bf1df27 commit fb26eaa

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
/dist/
2+
/django_threaded_sync_to_async.egg-info/
13
__pycache__/

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
## `django_threaded_sync_to_async`
22

3-
FIXME add description
3+
Tools for replacing `sync_to_async` calls to `sync_to_async(thread_sensitive=None, executor=...)`, effectively allowing Django to make calls to database concurrently.
44

5-
### `Executor`
5+
```
6+
pip3 install django_threaded_sync_to_async
7+
```
68

7-
Under executor context, `Executor` replaces `sync_to_async` calls to `sync_to_async(thread_sensitive=None, executor=...)`, effectively allowing Django to make calls to database concurrently:
9+
### `Executor`
810

911
```python3
12+
import django_threaded_sync_to_async
13+
1014
async with django_threaded_sync_to_async.Executor(thread_name_prefix="thread", max_workers=3) as executor:
1115
a = asgiref.sync.sync_to_async(long_call)(1)
1216
b = asgiref.sync.sync_to_async(long_call)(2)
@@ -20,6 +24,8 @@ async with django_threaded_sync_to_async.Executor(thread_name_prefix="thread", m
2024
Maintains global dictionary of executors (`concurrent.futures.ThreadPoolExecutor`) accessed by name and allows to limit utilization of executor for a single context.
2125

2226
```python3
27+
import django_threaded_sync_to_async
28+
2329
@django_threaded_sync_to_async.SharedExecutor("common", max_workers=3, max_tasks=2)
2430
def operations():
2531
a = asgiref.sync.sync_to_async(long_call)(1)

0 commit comments

Comments
 (0)