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:
parent
7aca475393
commit
ce5a1dfe98
3 changed files with 10 additions and 5 deletions
7
timers.py
Normal file
7
timers.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
from uwsgidecorators import timer
|
||||||
|
from woodwind import tasks
|
||||||
|
|
||||||
|
|
||||||
|
@timer(300)
|
||||||
|
def tick(signum=None):
|
||||||
|
tasks.q.enqueue(tasks.tick)
|
|
@ -5,5 +5,5 @@ threads=4
|
||||||
socket=/tmp/woodwind.sock
|
socket=/tmp/woodwind.sock
|
||||||
chmod-socket=666
|
chmod-socket=666
|
||||||
module=woodwind.wsgi
|
module=woodwind.wsgi
|
||||||
attach-daemon=rqworker
|
import=timers
|
||||||
import=woodwind.tasks
|
attach-daemon=venv/bin/rqworker
|
|
@ -1,7 +1,6 @@
|
||||||
from config import Config
|
from config import Config
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from redis import StrictRedis
|
from redis import StrictRedis
|
||||||
from uwsgidecorators import timer
|
|
||||||
from woodwind.models import Feed, Entry
|
from woodwind.models import Feed, Entry
|
||||||
import bs4
|
import bs4
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -45,8 +44,7 @@ def session_scope():
|
||||||
session.close()
|
session.close()
|
||||||
|
|
||||||
|
|
||||||
@timer(300)
|
def tick():
|
||||||
def tick(signum=None):
|
|
||||||
"""Checks all feeds to see if any of them are ready for an update.
|
"""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
|
Makes use of uWSGI timers to run every 5 minutes, without needing
|
||||||
a separate process to fire ticks.
|
a separate process to fire ticks.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue