Spaces:
Running
on
Zero
Running
on
Zero
macadeliccc
commited on
Commit
·
ebcc5ea
1
Parent(s):
c375c59
test:
Browse files
app.py
CHANGED
@@ -43,10 +43,18 @@ async def monitor_server():
|
|
43 |
|
44 |
await asyncio.sleep(60) # Check every 60 seconds
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
start_ochat_server()
|
47 |
|
48 |
# Start the monitoring in a separate thread
|
49 |
-
|
|
|
50 |
thread.start()
|
51 |
|
52 |
# Function to send a message to the ochat server and get a response
|
|
|
43 |
|
44 |
await asyncio.sleep(60) # Check every 60 seconds
|
45 |
|
46 |
+
def run_async_monitor():
|
47 |
+
loop = asyncio.new_event_loop()
|
48 |
+
asyncio.set_event_loop(loop)
|
49 |
+
loop.run_until_complete(monitor_server())
|
50 |
+
loop.close()
|
51 |
+
|
52 |
+
|
53 |
start_ochat_server()
|
54 |
|
55 |
# Start the monitoring in a separate thread
|
56 |
+
|
57 |
+
thread = threading.Thread(target=run_async_monitor)
|
58 |
thread.start()
|
59 |
|
60 |
# Function to send a message to the ochat server and get a response
|