phenomenon1981 commited on
Commit
ee363a7
1 Parent(s): 29bd9c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -7,6 +7,7 @@ import string
7
  import time
8
  from queue import Queue
9
  from threading import Thread
 
10
 
11
  queue = Queue()
12
  queue_threshold = 30
@@ -154,9 +155,11 @@ myface.launch(enable_queue=True, inline=True)
154
  block.queue(concurrency_count=15, max_size=30).launch(max_threads=20)
155
  def restart_script_periodically():
156
  while True:
157
- time.sleep(120) # 5 minutes
158
- os.execl(sys.executable, sys.executable, *sys.argv)
 
159
 
160
  restart_thread = Thread(target=restart_script_periodically, daemon=True)
161
  restart_thread.start()
162
  reset_queue_thread.join()
 
 
7
  import time
8
  from queue import Queue
9
  from threading import Thread
10
+ import subprocess
11
 
12
  queue = Queue()
13
  queue_threshold = 30
 
155
  block.queue(concurrency_count=15, max_size=30).launch(max_threads=20)
156
  def restart_script_periodically():
157
  while True:
158
+ time.sleep(30) # 5 minutes
159
+ os.kill(os.getpid(), 9)
160
+ subprocess.run(["python", "app.py"], timeout=60)
161
 
162
  restart_thread = Thread(target=restart_script_periodically, daemon=True)
163
  restart_thread.start()
164
  reset_queue_thread.join()
165
+