mirror of
https://github.com/bellingcat/auto-archiver-api.git
synced 2026-06-12 05:28:34 +03:00
introduces low/high priority queue and custom concurrency
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
import base64
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
|
||||
|
||||
def custom_jsonable_encoder(obj):
|
||||
if isinstance(obj, bytes):
|
||||
return base64.b64encode(obj).decode('utf-8')
|
||||
return jsonable_encoder(obj)
|
||||
|
||||
|
||||
def convert_priority_to_queue_dict(priority: str) -> dict:
|
||||
return {
|
||||
"priority": 0 if priority == "high" else 10,
|
||||
"queue": f"{priority}_priority"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user