Commit e6e48c6 1 parent 80c7410 commit e6e48c6 Copy full SHA for e6e48c6
File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ def get_message(self):
147
147
if capture :
148
148
try :
149
149
status = self .lacus .get_capture_status (capture .uuid )
150
+ print (status )
150
151
if status == crawlers .CaptureStatus .DONE :
151
152
return capture
152
153
elif status == crawlers .CaptureStatus .UNKNOWN :
@@ -164,7 +165,10 @@ def get_message(self):
164
165
self .logger .warning (f'capture UNKNOWN Timeout, { task .uuid } Send back in queue' )
165
166
else :
166
167
capture .update (status )
167
- elif status == crawlers .CaptureStatus .QUEUED or status == crawlers .CaptureStatus .ONGOING :
168
+ elif status == crawlers .CaptureStatus .QUEUED :
169
+ capture .update (status , delta = 30 )
170
+ print (capture .uuid , crawlers .CaptureStatus (status ).name , int (time .time () + 30 ))
171
+ elif status == crawlers .CaptureStatus .ONGOING :
168
172
capture .update (status )
169
173
print (capture .uuid , crawlers .CaptureStatus (status ).name , int (time .time ()))
170
174
# Invalid State
Original file line number Diff line number Diff line change @@ -1531,13 +1531,13 @@ def create(self, task_uuid):
1531
1531
r_crawler .zadd ('crawler:captures' , {self .uuid : launch_time })
1532
1532
r_cache .zadd ('crawler:captures' , {self .uuid : launch_time })
1533
1533
1534
- def update (self , status ):
1534
+ def update (self , status , delta = 0 ):
1535
1535
# Error or Reload
1536
1536
if not status :
1537
1537
r_cache .hset (f'crawler:capture:{ self .uuid } ' , 'status' , CaptureStatus .UNKNOWN .value )
1538
1538
r_cache .zadd ('crawler:captures' , {self .uuid : 0 })
1539
1539
else :
1540
- last_check = int (time .time ())
1540
+ last_check = int (time .time () + delta )
1541
1541
r_cache .hset (f'crawler:capture:{ self .uuid } ' , 'status' , status )
1542
1542
r_cache .zadd ('crawler:captures' , {self .uuid : last_check })
1543
1543
You can’t perform that action at this time.
0 commit comments