Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions karton/core/karton.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,15 @@ 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.
Set 0 for unlimited, and None for using global value
"""

filters: List[Dict[str, Any]] = []
persistent: bool = True
version: Optional[str] = None
task_timeout = None

def __init__(
self,
Expand All @@ -130,7 +134,8 @@ def __init__(
self.config.getboolean("karton", "persistent", self.persistent)
and not self.debug
)
self.task_timeout = 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 Expand Up @@ -323,7 +328,7 @@ def loop(self) -> None:
"""
self.log.info("Service %s started", self.identity)

if self.task_timeout is not None:
if self.task_timeout:
self.log.info(f"Task timeout is set to {self.task_timeout} seconds")

# Get the old binds and set the new ones atomically
Expand Down
Loading