Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Matvey-Kuk committed Nov 21, 2024
1 parent cb65b37 commit 0e502d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions keep/api/core/report_uptime.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import time
import asyncio
import logging
import threading
Expand All @@ -18,13 +19,13 @@ async def report_uptime_to_posthog():
Should be lunched in a separate thread.
"""
while True:
start_time = asyncio.get_event_loop().time()
start_time = time.time()
properties = {
"status": "up",
"keep_version": KEEP_VERSION,
**get_activity_report(),
}
end_time = asyncio.get_event_loop().time()
end_time = time.time()
properties["db_request_duration_ms"] = int((end_time - start_time) * 1000)
posthog_client.capture(
get_or_creat_posthog_instance_id(),
Expand Down
4 changes: 3 additions & 1 deletion keep/server_jobs_bg.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ def main():
threads = []
threads.append(launch_demo_mode_thread(keep_api_url))
threads.append(launch_uptime_reporting_thread())

logger.info("Background server jobs threads launched, joining them.")

for thread in threads:
if thread is not None:
thread.join()

logger.info("Background server jobs started.")
logger.info("Background server jobs script executed and exiting.")


if __name__ == "__main__":
Expand Down

0 comments on commit 0e502d5

Please sign in to comment.