Commit 8d801fe6 authored by Marco Mariani's avatar Marco Mariani

queue multiple callbacks

parent 24a50d1d
from datetime import datetime
import csv
import feedparser
import io
import socket
import json
import time
......@@ -82,16 +83,16 @@ def notify():
except AttributeError:
abort(httplib.BAD_REQUEST)
with open(callback_filepath, 'r') as callback_file:
callback = callback_file.read()
abort_it = False
for callback in io.open(callback_filepath, 'r', encoding='utf8'):
timestamp = int(math.floor(time.mktime(feed.feed.updated_parsed)))
equeue_request = json.dumps(dict(
command=callback,
timestamp=timestamp,
))
equeue_request = json.dumps({
'command': callback,
'timestamp': timestamp,
})
equeue_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
equeue_socket.connect(app.config['EQUEUE_SOCKET'])
......@@ -100,6 +101,10 @@ def notify():
equeue_socket.close()
if result != callback:
abort_it = True
if abort_it:
# XXX if possible, communicate info about the failed callbacks
abort(httplib.INTERNAL_SERVER_ERROR)
return '', httplib.NO_CONTENT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment