Skip to content

Commit

Permalink
Fix high CPU usage in idle
Browse files Browse the repository at this point in the history
  • Loading branch information
rexzhang committed Feb 3, 2024
1 parent 2909e6b commit f6d9670
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion django_toosimple_q/management/commands/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import signal
from traceback import format_exc
from time import sleep

from django.core.management.base import BaseCommand, CommandError
from django.db import IntegrityError, transaction
Expand Down Expand Up @@ -241,7 +242,7 @@ def do_loop(self) -> bool:
logger.debug(f"Waiting for next tick...")
next_run = last_run + datetime.timedelta(seconds=self.tick_duration)
while not self.exit_requested and now() < next_run:
pass
sleep(1)

return True

Expand Down

0 comments on commit f6d9670

Please sign in to comment.