Skip to content

Commit

Permalink
Allow to use "0" for disabling global task_timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Rakovsky committed Jan 4, 2025
1 parent 2f5fad1 commit d49d294
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions karton/core/karton.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Consumer(KartonServiceBase):
:param config: Karton config to use for service configuration
:param identity: Karton service identity
:param backend: Karton backend to use
:param task_timeout: The maximum time, in seconds, this consumer will wait for a task to finish processing before being CRASHED on timeout
:param task_timeout: The maximum time, in seconds, this consumer will wait for a task to finish processing before being CRASHED on timeout. Set 0 for unlimited, and None for using global value
"""

filters: List[Dict[str, Any]] = []
Expand All @@ -132,7 +132,8 @@ def __init__(
self.config.getboolean("karton", "persistent", self.persistent)
and not self.debug
)
self.task_timeout = self.task_timeout or self.config.getint("karton", "task_timeout")
if self.task_timeout is None:
self.task_timeout = self.config.getint("karton", "task_timeout")
self.current_task: Optional[Task] = None
self._pre_hooks: List[Tuple[Optional[str], Callable[[Task], None]]] = []
self._post_hooks: List[
Expand Down

0 comments on commit d49d294

Please sign in to comment.