Spaces:
Sleeping
Sleeping
Update worker.py
Browse files
worker.py
CHANGED
@@ -25,11 +25,7 @@ firebase_admin.initialize_app(cred, {'storageBucket': fire_bucket})
|
|
25 |
ref = db.reference('/Tasks',url=fire_url)
|
26 |
bucket = storage.bucket()
|
27 |
|
28 |
-
|
29 |
-
IsSuperbase = False
|
30 |
-
current_time = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=-5))) # Eastern Standard Time offset
|
31 |
-
if current_time.day > 15:
|
32 |
-
IsSuperbase = True
|
33 |
|
34 |
class Task:
|
35 |
def __init__(self,tasks):
|
@@ -80,6 +76,12 @@ class Task:
|
|
80 |
return None
|
81 |
|
82 |
def check_queue():
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
if IsSuperbase:
|
84 |
try:
|
85 |
tasks = supabase.table("Tasks").select("*").eq("status", "pending").execute()
|
@@ -141,7 +143,12 @@ def send_back_to_supabase(task_id):
|
|
141 |
print(f"Error: No file was created for task {task_id}")
|
142 |
|
143 |
def worker():
|
144 |
-
while True
|
|
|
|
|
|
|
|
|
|
|
145 |
task = check_queue()
|
146 |
if task:
|
147 |
if IsSuperbase:
|
|
|
25 |
ref = db.reference('/Tasks',url=fire_url)
|
26 |
bucket = storage.bucket()
|
27 |
|
28 |
+
|
|
|
|
|
|
|
|
|
29 |
|
30 |
class Task:
|
31 |
def __init__(self,tasks):
|
|
|
76 |
return None
|
77 |
|
78 |
def check_queue():
|
79 |
+
# Check if it is the second half of the month in Eastern Standard Time
|
80 |
+
IsSuperbase = False
|
81 |
+
current_time = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=-5))) # Eastern Standard Time offset
|
82 |
+
if current_time.day > 15:
|
83 |
+
IsSuperbase = True
|
84 |
+
|
85 |
if IsSuperbase:
|
86 |
try:
|
87 |
tasks = supabase.table("Tasks").select("*").eq("status", "pending").execute()
|
|
|
143 |
print(f"Error: No file was created for task {task_id}")
|
144 |
|
145 |
def worker():
|
146 |
+
while True:# Check if it is the second half of the month in Eastern Standard Time
|
147 |
+
IsSuperbase = False
|
148 |
+
current_time = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=-5))) # Eastern Standard Time offset
|
149 |
+
if current_time.day > 15:
|
150 |
+
IsSuperbase = True
|
151 |
+
|
152 |
task = check_queue()
|
153 |
if task:
|
154 |
if IsSuperbase:
|