mirror of
https://github.com/tubearchivist/tubearchivist-server.git
synced 2024-11-21 11:20:12 +00:00
call create_queue in builder too
This commit is contained in:
parent
6451e1c51f
commit
fcceab3150
@ -4,6 +4,8 @@ import json
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import redis
|
||||
|
||||
|
||||
@ -47,6 +49,20 @@ class Monitor(RedisBase):
|
||||
else:
|
||||
print("tubearchivist builder already created")
|
||||
|
||||
def create_queue(self):
|
||||
"""set initial json object for queue"""
|
||||
if self.conn.execute_command(f"EXISTS {self.TASK_KEY}"):
|
||||
print(f"{self.TASK_KEY} already exists")
|
||||
return
|
||||
|
||||
message = {
|
||||
"created": int(datetime.now().strftime("%s")),
|
||||
"tasks": {}
|
||||
}
|
||||
self.conn.execute_command(
|
||||
"JSON.SET", self.TASK_KEY, ".", json.dumps(message)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _create_builder():
|
||||
"""create buildx builder"""
|
||||
@ -139,6 +155,7 @@ class Builder(RedisBase):
|
||||
if __name__ == "__main__":
|
||||
handler = Monitor()
|
||||
handler.bootstrap()
|
||||
handler.create_queue()
|
||||
handler.check_stored()
|
||||
try:
|
||||
handler.watch()
|
||||
|
Loading…
Reference in New Issue
Block a user