Mihaiii commited on
Commit
466eeae
·
verified ·
1 Parent(s): ba9af76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,11 +1,15 @@
1
  import subprocess
2
-
3
- subprocess.run(["python3", "TimeStampBuddy/cron_processor.py"])
4
-
5
  from fastapi import FastAPI
 
6
 
7
  app = FastAPI()
8
 
 
 
 
 
 
 
9
  @app.get("/")
10
  def greet_json():
11
  return {"Hello": "World!"}
 
1
  import subprocess
 
 
 
2
  from fastapi import FastAPI
3
+ from concurrent.futures import ThreadPoolExecutor
4
 
5
  app = FastAPI()
6
 
7
+ def start_worker():
8
+ subprocess.run(["python3", "TimeStampBuddy/cron_processor.py"])
9
+
10
+ executor = ThreadPoolExecutor(max_workers=1)
11
+ executor.submit(start_worker)
12
+
13
  @app.get("/")
14
  def greet_json():
15
  return {"Hello": "World!"}