Use msgpack for jobs

This commit is contained in:
2022-12-31 14:49:43 +01:00
parent 6a40ca3c44
commit 0644122364
3 changed files with 569 additions and 505 deletions

1067
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -20,6 +20,7 @@ ormar = {extras = ["postgresql"], version = "^0.12.0"}
greenlet = "^2.0.1"
pydantic = "1.10.2"
redis = {extras = ["hiredis"], version = "^4.4.0"}
msgpack = "^1.0.4"
[tool.poetry.dev-dependencies]

View File

@@ -1,3 +1,5 @@
import msgpack
from app.services.cache_updater import (
check_books,
cache_file_by_book_id,
@@ -28,5 +30,7 @@ class WorkerSettings:
on_shutdown = shutdown
redis_settings = get_redis_settings()
max_jobs = 2
max_tries = 3
max_tries = 1
job_timeout = 10 * 60
job_serializer = msgpack.packb
job_deserializer = lambda b: msgpack.unpackb(b, raw=False) # noqa: E731