From ecdfb6d2e13ad66f90d961d44fc69c13a2a2d4a4 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 10 Mar 2021 15:13:45 +0300 Subject: Queue the command only once --- gn3/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gn3/commands.py b/gn3/commands.py index e5558fe..4b0d62d 100644 --- a/gn3/commands.py +++ b/gn3/commands.py @@ -52,9 +52,9 @@ Returns the name of the specific redis hash for the specific task. unique_id = ("cmd::" f"{datetime.now().strftime('%Y-%m-%d%H-%M%S-%M%S-')}" f"{str(uuid4())}") + conn.rpush(job_queue, unique_id) for key, value in {"cmd": cmd, "result": "", "status": "queued"}.items(): conn.hset(name=unique_id, key=key, value=value) - conn.rpush(job_queue, unique_id) if email: conn.hset(name=unique_id, key="email", value=email) return unique_id -- cgit v1.2.3