We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ffa8f53 commit 2ffc8c3Copy full SHA for 2ffc8c3
app/worker.py
@@ -11,19 +11,19 @@
11
redis_client = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT, decode_responses=True)
12
13
def process_job(job):
14
- print(f"Processing job: {job}")
+ print(f"Processing job: {job}", flush=True)
15
# Simulate the time to send a push notification
16
- time.sleep(1)
+ time.sleep(20)
17
18
def main():
19
- print("Worker started...")
+ print("Worker started...", flush=True)
20
while True:
21
- job = redis_client.lpop(QUEUE_NAME)
+ job = redis_client.blpop(QUEUE_NAME, 100)
22
if job:
23
process_job(job)
24
else:
25
- print("No jobs in queue. Waiting...")
+ print("No jobs in queue. Waiting...", flush=True)
26
time.sleep(5)
27
28
if __name__ == "__main__":
29
- main()
+ main()
0 commit comments