move uwsgi timers call to its own module; it can't live under tasks because rqworker can't import the uwsgi module

This commit is contained in:
Kyle Mahan 2015-03-14 20:00:19 +00:00
parent 7aca475393
commit ce5a1dfe98
3 changed files with 10 additions and 5 deletions

7
timers.py Normal file
View file

@ -0,0 +1,7 @@
from uwsgidecorators import timer
from woodwind import tasks
@timer(300)
def tick(signum=None):
tasks.q.enqueue(tasks.tick)

View file

@ -5,5 +5,5 @@ threads=4
socket=/tmp/woodwind.sock
chmod-socket=666
module=woodwind.wsgi
attach-daemon=rqworker
import=woodwind.tasks
import=timers
attach-daemon=venv/bin/rqworker

View file

@ -1,7 +1,6 @@
from config import Config
from contextlib import contextmanager
from redis import StrictRedis
from uwsgidecorators import timer
from woodwind.models import Feed, Entry
import bs4
import datetime
@ -45,8 +44,7 @@ def session_scope():
session.close()
@timer(300)
def tick(signum=None):
def tick():
"""Checks all feeds to see if any of them are ready for an update.
Makes use of uWSGI timers to run every 5 minutes, without needing
a separate process to fire ticks.