Skip to content

Commit

Permalink
Make LoggingThread recover on all errors
Browse files Browse the repository at this point in the history
Previously, LoggingThread would recover from any XML-RPC fault,
but would stop when any other type of exception was encountered.
That is a problem, as it means the worker will permanently give
up sending messages to the hub when all kinds of temporary
issues occur (e.g. a temporary network disruption between worker
and hub). The task underneath may continue running for hours,
with all log messages being discarded.

Given the nature of this thread, it makes more sense to attempt
recovering from *all* kinds of errors, as we should try hard not
to lose log messages from a task.

Fixes #60
  • Loading branch information
rohanpm committed Jan 4, 2019
1 parent e038778 commit ef5bb1d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kobo/worker/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import six

from six.moves import StringIO, queue
from six.moves.xmlrpc_client import Fault


__all__ = (
Expand Down Expand Up @@ -55,7 +54,7 @@ def run(self):
self._hub.upload_task_log(StringIO(self._send_data), self._task_id, "stdout.log", append=True)
self._send_time = now
self._send_data = ""
except Fault:
except Exception:
continue

def write(self, data):
Expand Down

0 comments on commit ef5bb1d

Please sign in to comment.