Skip to content

Commit 36803a0

Browse files
committed
[client] Catch exceptions
1 parent 1818d5e commit 36803a0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pyobas/helpers.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,15 @@ def _schedule(self, scheduler, message_callback, delay):
348348

349349
def schedule(self, message_callback, delay):
350350
# Start execution directly
351-
message_callback()
352-
now = datetime.now(timezone.utc).isoformat()
353-
self.api.collector.update(
354-
self.config_helper.get_conf("collector_id"),
355-
{"collector_last_execution": now},
356-
)
351+
try:
352+
message_callback()
353+
now = datetime.now(timezone.utc).isoformat()
354+
self.api.collector.update(
355+
self.config_helper.get_conf("collector_id"),
356+
{"collector_last_execution": now},
357+
)
358+
except Exception as err: # pylint: disable=broad-except
359+
self.collector_logger.error(str(err))
357360
# Then schedule the next execution
358361
self.scheduler.enter(
359362
delay, 1, self._schedule, (self.scheduler, message_callback, delay)

0 commit comments

Comments
 (0)