mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 19:11:09 +00:00
Create a separate celery queue for imports
This commit is contained in:
parent
1a2a5b8bd2
commit
427d0c4fc8
3 changed files with 6 additions and 4 deletions
|
@ -19,7 +19,7 @@ from bookwyrm.models import (
|
||||||
Review,
|
Review,
|
||||||
ReviewRating,
|
ReviewRating,
|
||||||
)
|
)
|
||||||
from bookwyrm.tasks import app, LOW
|
from bookwyrm.tasks import app, LOW, IMPORTS
|
||||||
from .fields import PrivacyLevels
|
from .fields import PrivacyLevels
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ class ImportItem(models.Model):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.task(queue=LOW)
|
@app.task(queue=IMPORTS)
|
||||||
def start_import_task(job_id):
|
def start_import_task(job_id):
|
||||||
"""trigger the child tasks for each row"""
|
"""trigger the child tasks for each row"""
|
||||||
job = ImportJob.objects.get(id=job_id)
|
job = ImportJob.objects.get(id=job_id)
|
||||||
|
@ -345,7 +345,7 @@ def start_import_task(job_id):
|
||||||
job.save()
|
job.save()
|
||||||
|
|
||||||
|
|
||||||
@app.task(queue=LOW)
|
@app.task(queue=IMPORTS)
|
||||||
def import_item_task(item_id):
|
def import_item_task(item_id):
|
||||||
"""resolve a row into a book"""
|
"""resolve a row into a book"""
|
||||||
item = ImportItem.objects.get(id=item_id)
|
item = ImportItem.objects.get(id=item_id)
|
||||||
|
|
|
@ -14,3 +14,5 @@ app = Celery(
|
||||||
LOW = "low_priority"
|
LOW = "low_priority"
|
||||||
MEDIUM = "medium_priority"
|
MEDIUM = "medium_priority"
|
||||||
HIGH = "high_priority"
|
HIGH = "high_priority"
|
||||||
|
# import items get their own queue because they're such a pain in the ass
|
||||||
|
IMPORTS = "imports"
|
||||||
|
|
|
@ -62,7 +62,7 @@ services:
|
||||||
build: .
|
build: .
|
||||||
networks:
|
networks:
|
||||||
- main
|
- main
|
||||||
command: celery -A celerywyrm worker -l info -Q high_priority,medium_priority,low_priority
|
command: celery -A celerywyrm worker -l info -Q high_priority,medium_priority,low_priority,imports
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
- static_volume:/app/static
|
- static_volume:/app/static
|
||||||
|
|
Loading…
Reference in a new issue