Skip to content

Commit caff4ba

Browse files
committed
major parsing fixes
1 parent 2121853 commit caff4ba

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

Procfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
web: gunicorn hello:app --log-file=-
2-
worker: python worker.py
2+
worker: python otherworker.py

otherworker.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import time
2+
from hello import workerstuff
3+
4+
start=time.time()
5+
interval=30
6+
while True:
7+
if time.time()>=interval+start:
8+
start=time.time()
9+
workerstuff()

worker.py

+18-10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
from rq import Worker, Queue, Connection
44
import time
55

6+
from rq_scheduler import Scheduler
7+
from datetime import datetime
8+
69
from hello import workerstuff
710

811
listen =['high', 'default', 'low']
@@ -14,18 +17,23 @@
1417
print redis_url
1518
conn=redis.from_url(redis_url)
1619

20+
use_connection()
1721

22+
scheduler=Scheduler()
23+
scheduler.schedule(
24+
datetime.now(),
25+
workerstuff,
26+
interval=30
27+
)
1828

19-
q=Queue(connection=conn)
20-
result=q.enqueue(workerstuff)
29+
#
30+
#
31+
# q=Queue(connection=conn)
32+
# q.
33+
# result=q.enqueue(workerstuff)
2134

2235

2336
if __name__ == '__main__':
24-
start=time.time()
25-
interval=30
26-
while True:
27-
if time.time()>=interval+start:
28-
start=time.time()
29-
with Connection(conn):
30-
worker=Worker(map(Queue, listen))
31-
worker.work()
37+
with Connection(conn):
38+
worker=Worker(map(Queue, listen))
39+
worker.work()

0 commit comments

Comments
 (0)