Commit 0e502d5 1 parent cb65b37 commit 0e502d5 Copy full SHA for 0e502d5
File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change
1
+ import time
1
2
import asyncio
2
3
import logging
3
4
import threading
@@ -18,13 +19,13 @@ async def report_uptime_to_posthog():
18
19
Should be lunched in a separate thread.
19
20
"""
20
21
while True :
21
- start_time = asyncio . get_event_loop () .time ()
22
+ start_time = time .time ()
22
23
properties = {
23
24
"status" : "up" ,
24
25
"keep_version" : KEEP_VERSION ,
25
26
** get_activity_report (),
26
27
}
27
- end_time = asyncio . get_event_loop () .time ()
28
+ end_time = time .time ()
28
29
properties ["db_request_duration_ms" ] = int ((end_time - start_time ) * 1000 )
29
30
posthog_client .capture (
30
31
get_or_creat_posthog_instance_id (),
Original file line number Diff line number Diff line change @@ -29,12 +29,14 @@ def main():
29
29
threads = []
30
30
threads .append (launch_demo_mode_thread (keep_api_url ))
31
31
threads .append (launch_uptime_reporting_thread ())
32
+
33
+ logger .info ("Background server jobs threads launched, joining them." )
32
34
33
35
for thread in threads :
34
36
if thread is not None :
35
37
thread .join ()
36
38
37
- logger .info ("Background server jobs started ." )
39
+ logger .info ("Background server jobs script executed and exiting ." )
38
40
39
41
40
42
if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments