File tree 3 files changed +28
-11
lines changed
3 files changed +28
-11
lines changed Original file line number Diff line number Diff line change 1
1
web : gunicorn hello:app --log-file=-
2
- worker : python worker .py
2
+ worker : python otherworker .py
Original file line number Diff line number Diff line change
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 ()
Original file line number Diff line number Diff line change 3
3
from rq import Worker , Queue , Connection
4
4
import time
5
5
6
+ from rq_scheduler import Scheduler
7
+ from datetime import datetime
8
+
6
9
from hello import workerstuff
7
10
8
11
listen = ['high' , 'default' , 'low' ]
14
17
print redis_url
15
18
conn = redis .from_url (redis_url )
16
19
20
+ use_connection ()
17
21
22
+ scheduler = Scheduler ()
23
+ scheduler .schedule (
24
+ datetime .now (),
25
+ workerstuff ,
26
+ interval = 30
27
+ )
18
28
19
- q = Queue (connection = conn )
20
- result = q .enqueue (workerstuff )
29
+ #
30
+ #
31
+ # q=Queue(connection=conn)
32
+ # q.
33
+ # result=q.enqueue(workerstuff)
21
34
22
35
23
36
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 ()
You can’t perform that action at this time.
0 commit comments