mirror of
https://github.com/tubearchivist/tubearchivist-server.git
synced 2024-11-22 03:40: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 subprocess
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
import redis
|
import redis
|
||||||
|
|
||||||
|
|
||||||
@ -47,6 +49,20 @@ class Monitor(RedisBase):
|
|||||||
else:
|
else:
|
||||||
print("tubearchivist builder already created")
|
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
|
@staticmethod
|
||||||
def _create_builder():
|
def _create_builder():
|
||||||
"""create buildx builder"""
|
"""create buildx builder"""
|
||||||
@ -139,6 +155,7 @@ class Builder(RedisBase):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
handler = Monitor()
|
handler = Monitor()
|
||||||
handler.bootstrap()
|
handler.bootstrap()
|
||||||
|
handler.create_queue()
|
||||||
handler.check_stored()
|
handler.check_stored()
|
||||||
try:
|
try:
|
||||||
handler.watch()
|
handler.watch()
|
||||||
|
Loading…
Reference in New Issue
Block a user