formatting / RQ tuning

This commit is contained in:
2025-08-15 13:39:27 -04:00
parent 93050ec6cf
commit 0cd4a71db2
2 changed files with 18 additions and 11 deletions

View File

@@ -11,6 +11,7 @@ from utils.rip_background import bulk_download
from lyric_search.sources import private
from pydantic import BaseModel
class ValidBulkFetchRequest(BaseModel):
track_ids: list[int]
@@ -119,7 +120,13 @@ class RIP(FastAPI):
}
)
track_ids = data.track_ids
job = self.task_queue.enqueue(bulk_download, track_ids)
job = self.task_queue.enqueue(
bulk_download,
args=(track_ids,),
timeout=3600,
failure_ttl=86400,
result_ttl=86400,
)
self.redis_conn.lpush("enqueued_job_ids", job.id)
return JSONResponse(
content={
@@ -150,7 +157,7 @@ class RIP(FastAPI):
"""List all jobs in the queue (queued + finished, if result_ttl allows)"""
jobs_info = []
# 1 Jobs still in the queue (pending)
# Jobs still in the queue (pending)
for job in self.task_queue.jobs:
jobs_info.append(
{
@@ -162,7 +169,7 @@ class RIP(FastAPI):
}
)
# 2 Started/running jobs tracked via enqueued_job_ids
# Started/running jobs tracked via enqueued_job_ids
job_ids = self.redis_conn.lrange("enqueued_job_ids", 0, -1)
for jid_bytes in job_ids: # type: ignore
jid = jid_bytes.decode()