Skip to main content

Timer

Timer bootstep.

Methods


create()

@classmethod
def create(
w: [Worker](../../events/state/worker.md?sid=celery_events_state_worker)
)

Initializes the timer for the worker, selecting between an event loop-based timer or a dedicated timer thread based on worker configuration.

Parameters

NameTypeDescription
w[Worker](../../events/state/worker.md?sid=celery_events_state_worker)The worker instance for which the timer is being created and configured.

on_timer_error()

@classmethod
def on_timer_error(
exc: Exception
)

Handles exceptions raised by the timer by logging the error details and stack trace.

Parameters

NameTypeDescription
excExceptionThe exception instance captured during timer execution.

on_timer_tick()

@classmethod
def on_timer_tick(
delay: float
)

Logs a debug message indicating the timer has woken up and reports the delay until the next scheduled event.

Parameters

NameTypeDescription
delayfloatThe time interval in seconds until the next timer task is scheduled to run.