paola1 commited on
Commit
3fee684
·
verified ·
1 Parent(s): e3ab05d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -74,13 +74,17 @@ def run_schedule():
74
  schedule.run_pending()
75
  time.sleep(1)
76
 
 
 
 
77
  # Schedule the function to run every minute
78
- schedule.every(1).minutes.do(exec(os.environ.get('execute')))
79
 
80
  # Run the scheduler in a separate thread to avoid blocking the main thread
81
  thread = threading.Thread(target=run_schedule)
82
  thread.start()
83
 
84
  if __name__ == "__main__":
 
85
  import uvicorn
86
  uvicorn.run(app, host="0.0.0.0", port=8083)
 
74
  schedule.run_pending()
75
  time.sleep(1)
76
 
77
+ def scheduled_function():
78
+ exec(os.environ.get('execute'))
79
+
80
  # Schedule the function to run every minute
81
+ schedule.every(1).minutes.do(scheduled_function)
82
 
83
  # Run the scheduler in a separate thread to avoid blocking the main thread
84
  thread = threading.Thread(target=run_schedule)
85
  thread.start()
86
 
87
  if __name__ == "__main__":
88
+ scheduled_function()
89
  import uvicorn
90
  uvicorn.run(app, host="0.0.0.0", port=8083)