Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
retrying apscheduler (now maximum 1 thread to avoid concurrency issues)
Browse files
app.py
CHANGED
|
@@ -17,6 +17,8 @@ import logging
|
|
| 17 |
import time
|
| 18 |
import pandas as pd
|
| 19 |
from apscheduler.schedulers.background import BackgroundScheduler
|
|
|
|
|
|
|
| 20 |
from gspread_dataframe import get_as_dataframe, set_with_dataframe
|
| 21 |
from gspread_formatting.dataframe import format_with_dataframe
|
| 22 |
import numpy as np
|
|
@@ -96,6 +98,11 @@ async def update_google_sheet():
|
|
| 96 |
except Exception as e:
|
| 97 |
print(f"on_message Error: {e}")
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
"""
|
| 100 |
scheduler = BackgroundScheduler()
|
| 101 |
scheduler.add_job(update_google_sheet, "interval", seconds=60)
|
|
@@ -291,10 +298,14 @@ async def add_exp(member_id):
|
|
| 291 |
print(f"Gave {member} {lvl1}") # can log this better
|
| 292 |
print(f"----------------------------------------------------")
|
| 293 |
|
|
|
|
| 294 |
if member_id == 811235357663297546:
|
| 295 |
await asyncio.sleep(1.1)
|
| 296 |
await update_google_sheet()
|
| 297 |
-
await asyncio.sleep(1.1)
|
|
|
|
|
|
|
|
|
|
| 298 |
except Exception as e:
|
| 299 |
print(f"add_exp Error: {e}")
|
| 300 |
|
|
|
|
| 17 |
import time
|
| 18 |
import pandas as pd
|
| 19 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 20 |
+
|
| 21 |
+
|
| 22 |
from gspread_dataframe import get_as_dataframe, set_with_dataframe
|
| 23 |
from gspread_formatting.dataframe import format_with_dataframe
|
| 24 |
import numpy as np
|
|
|
|
| 98 |
except Exception as e:
|
| 99 |
print(f"on_message Error: {e}")
|
| 100 |
|
| 101 |
+
|
| 102 |
+
executor = ThreadPoolExecutor(max_workers=1)
|
| 103 |
+
scheduler = BackgroundScheduler(executors={'default': executor})
|
| 104 |
+
scheduler.add_job(update_google_sheet, trigger='interval', minutes=1)
|
| 105 |
+
scheduler.start()
|
| 106 |
"""
|
| 107 |
scheduler = BackgroundScheduler()
|
| 108 |
scheduler.add_job(update_google_sheet, "interval", seconds=60)
|
|
|
|
| 298 |
print(f"Gave {member} {lvl1}") # can log this better
|
| 299 |
print(f"----------------------------------------------------")
|
| 300 |
|
| 301 |
+
"""
|
| 302 |
if member_id == 811235357663297546:
|
| 303 |
await asyncio.sleep(1.1)
|
| 304 |
await update_google_sheet()
|
| 305 |
+
await asyncio.sleep(1.1)
|
| 306 |
+
|
| 307 |
+
"""
|
| 308 |
+
|
| 309 |
except Exception as e:
|
| 310 |
print(f"add_exp Error: {e}")
|
| 311 |
|