Skip to content

Commit

Permalink
fix: 在主循环中添加延迟以减少 CPU 占用
Browse files Browse the repository at this point in the history
  • Loading branch information
z0z0r4 committed Jan 30, 2025
1 parent aa68da9 commit 46ae0e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion start.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.interval import IntervalTrigger
import datetime
import time

from mcim_sync.database.mongodb import init_mongodb_syncengine
from mcim_sync.database._redis import init_redis_syncengine
Expand Down Expand Up @@ -85,7 +86,7 @@ def main():

try:
while True:
pass
time.sleep(1)
except (KeyboardInterrupt, SystemExit):
scheduler.shutdown()
log.info(f"Scheduler shutdown")
Expand Down

0 comments on commit 46ae0e6

Please sign in to comment.