telegram_bots/feeds/management/commands/worker_loop.py

18 lines
413 B
Python
Raw Normal View History

2019-01-11 19:16:01 +00:00
from time import sleep
from django.core.management import BaseCommand
from feeds.models import Feed
class Command(BaseCommand):
def handle(self, *args, **options):
try:
while True:
feeds = Feed.objects.filter(lock=False)
for feed in feeds:
feed.run_check()
sleep(5)
except KeyboardInterrupt:
pass