Skip to content

Commit e56b6e0

Browse files
committed
Set default timout
1 parent b38df32 commit e56b6e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

optimizerapi/optimizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
REDIS_URL = "redis://localhost:6379"
4444
print("Connecting to" + REDIS_URL)
4545
redis = Redis.from_url(REDIS_URL)
46-
queue = Queue(connection=redis)
4746
if "REDIS_TTL" in os.environ:
4847
TTL = int(os.environ["REDIS_TTL"])
4948
else:
@@ -53,6 +52,7 @@
5352
else:
5453
WORKER_TIMEOUT = 180
5554

55+
queue = Queue(connection=redis, job_timeout=WORKER_TIMEOUT)
5656
plt.switch_backend("Agg")
5757

5858

@@ -86,7 +86,7 @@ def disconnect_check():
8686
print("Found existing job")
8787
except NoSuchJobError:
8888
print("Creating new job")
89-
job = queue.enqueue(do_run_work, body, job_id=job_id, result_ttl=TTL, timeout=WORKER_TIMEOUT)
89+
job = queue.enqueue(do_run_work, body, job_id=job_id, result_ttl=TTL)
9090
while job.return_value() is None:
9191
if disconnect_check():
9292
try:

0 commit comments

Comments
 (0)