DeferredWebhookManager
class DeferredWebhookManager
Properties
| protected array<string, int> | $pending | Pending timer IDs keyed by "{type}:{appId}:{channel}[:{userId}]". |
|
| protected bool | $draining | Whether the manager is in draining mode (worker shutting down). |
|
| protected Timer | $timer |
Methods
Create a new deferred webhook manager instance.
Schedule a deferred channel_vacated webhook.
Schedule a deferred member_removed webhook.
Cancel a pending deferred channel_vacated webhook.
Cancel a pending deferred member_removed webhook.
Cancel all pending deferred webhook timers without firing them.
Enable draining mode (worker shutting down).
Determine whether the manager is in draining mode.
Cancel a pending timer by key.
Details
at line 31
__construct()
Create a new deferred webhook manager instance.
at line 39
void
deferChannelVacated(Application $app, string $channel, float $delaySeconds, int $smoothingTtlMs)
Schedule a deferred channel_vacated webhook.
at line 67
void
deferMemberRemoved(Application $app, string $channel, string $userId, float $delaySeconds, int $smoothingTtlMs)
Schedule a deferred member_removed webhook.
at line 98
bool
cancelChannelVacated(string $appId, string $channel)
Cancel a pending deferred channel_vacated webhook.
Returns true if a pending timer was cancelled (same-worker fast path).
at line 108
bool
cancelMemberRemoved(string $appId, string $channel, string $userId)
Cancel a pending deferred member_removed webhook.
Returns true if a pending timer was cancelled (same-worker fast path).
at line 119
void
cancelAll()
Cancel all pending deferred webhook timers without firing them.
NOT called during shutdown — pending timers fire naturally via the WORKER_EXIT coordinator. This method exists for testing cleanup.
at line 134
void
setDraining(bool $draining)
Enable draining mode (worker shutting down).
When draining, callers should fire webhooks immediately instead of deferring them.
at line 142
bool
isDraining()
Determine whether the manager is in draining mode.
at line 150
protected bool
cancel(string $key)
Cancel a pending timer by key.