Answer the question
In order to leave comments, you need to log in
How to correctly write elements from the RQ queue to the list?
I work with workers and queue
from rq import Queue
from redis import Redis
import time
redis_conn = Redis()
queue = Queue(connection=redis_conn)
list_int = []
def worker(num, timeout):
time.sleep(timeout)
list_int.append(num)
return num
from fastapi import FastAPI
@app.get("/api/{num}/{timeout}")
def read_root(num: int, timeout: int):
job = queue.enqueue(worker, num, timeout)
return {"Task": "in work"}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question