Skip to main content

deliver_slack_message

Function deliver_slack_message 

Source
pub(crate) fn deliver_slack_message(
    workspace: &Arc<Workspace>,
    project: &str,
    team_role: Option<&str>,
    messages: Vec<SlackMessage>,
) -> bool
Expand description

Deliver one conversation’s matched Slack messages to its subscriber’s session: dispatch them now when that session is running, buffer them on the session’s own domain when it is still spawning. Mirrors deliver_gotify_message, including its rule that a worker-owned subscription falls through to the lead only when the worker is gone entirely: the despawn race (teardown removed its subscriptions first), or a Failed entry, which is kept by design and is not live - a bucket parked for one would never drain. The fall-through commits under the worker’s own dedupe key, so the batch counts as delivered and stays with the lead: a durable worker that later respawns does not re-receive it.

Returns whether the batch reached a destination it can be read from: dispatched, or buffered for one that will. false tells the pump the cursor must not advance past this batch, so a sweep re-runs it - which is why the dedupe entries commit only after a successful hand-off.