SAAS-818: If the network connection is interrupted, pypo sometimes can't recover
This commit is contained in:
parent
a8d2290d00
commit
700fddbada
2 changed files with 19 additions and 8 deletions
|
@ -477,6 +477,7 @@ class PypoFetch(Thread):
|
|||
loops = 1
|
||||
while True:
|
||||
self.logger.info("Loop #%s", loops)
|
||||
manual_fetch_needed = False
|
||||
try:
|
||||
"""
|
||||
our simple_queue.get() requires a timeout, in which case we
|
||||
|
@ -492,17 +493,26 @@ class PypoFetch(Thread):
|
|||
Currently we are checking every POLL_INTERVAL seconds
|
||||
"""
|
||||
|
||||
|
||||
message = self.fetch_queue.get(block=True, timeout=self.listener_timeout)
|
||||
manual_fetch_needed = False
|
||||
self.handle_message(message)
|
||||
except Empty, e:
|
||||
except Empty as e:
|
||||
self.logger.info("Queue timeout. Fetching schedule manually")
|
||||
self.persistent_manual_schedule_fetch(max_attempts=5)
|
||||
except Exception, e:
|
||||
manual_fetch_needed = True
|
||||
except Exception as e:
|
||||
top = traceback.format_exc()
|
||||
self.logger.error('Exception: %s', e)
|
||||
self.logger.error("traceback: %s", top)
|
||||
|
||||
try:
|
||||
if manual_fetch_needed:
|
||||
self.persistent_manual_schedule_fetch(max_attempts=5)
|
||||
except Exception as e:
|
||||
top = traceback.format_exc()
|
||||
self.logger.error('Failed to manually fetch the schedule.')
|
||||
self.logger.error('Exception: %s', e)
|
||||
self.logger.error("traceback: %s", top)
|
||||
|
||||
loops += 1
|
||||
|
||||
def run(self):
|
||||
|
@ -510,3 +520,4 @@ class PypoFetch(Thread):
|
|||
Entry point of the thread
|
||||
"""
|
||||
self.main()
|
||||
self.logger.info('PypoFetch thread exiting')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue