Merge branch 'master' of github.com:kylewm/woodwind

This commit is contained in:
Kyle Mahan 2015-03-15 10:40:51 -07:00
commit 9ec34de4fc
5 changed files with 15 additions and 14 deletions

1
fabfile.py vendored
View file

@ -32,7 +32,6 @@ def restart():
with prefix("source venv/bin/activate"): with prefix("source venv/bin/activate"):
run("pip install --upgrade -r requirements.txt") run("pip install --upgrade -r requirements.txt")
sudo("restart woodwind") sudo("restart woodwind")
sudo("restart woodwind-celery")
sudo("restart woodwind-tornado") sudo("restart woodwind-tornado")

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 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

View file

@ -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.

View file

@ -46,17 +46,14 @@
</div> </div>
{% endif %} {% endif %}
{% if entry._syndicated_copies %}
<div>
Also on
{% for copy in entry._syndicated_copies %}
{{ copy.permalink | domain_for_url }}
{% endfor %}
</div>
{% endif %}
<footer> <footer>
<a href="{{ entry.permalink }}">{{ entry.published | relative_time }}</a> <a href="{{ entry.permalink }}">{{ entry.published | relative_time }}</a>
{% if entry._syndicated_copies %}
(also on{% for copy in entry._syndicated_copies %} <a href="{{ copy.permalink }}">{{ copy.permalink | domain_for_url }}</a>{% endfor %})
{% endif %}
<div class="reply-area"> <div class="reply-area">
{% include '_reply.jinja2' with context %} {% include '_reply.jinja2' with context %}
</div> </div>