Skip to content

subscriberBroadcaster is dead code wired through an unused wrapJobCtx.broadcast field #119

@nficano

Description

@nficano

Category: clean-code Severity: minor
Location: packages/runtime/src/job-runner.ts:682-691

What

subscriberBroadcaster's only consumer passes it into wrapJobCtx as the unused required field broadcast (job-runner-helpers.ts:52-74, destructured nowhere), so the method is never actually invoked; subscriber fan-out happens via the SessionContext.send pipeline instead. Dead code that implies fan-out happens here.

Evidence

private subscriberBroadcaster(job: Job): SubscriberBroadcaster {
    return (env: BaseEnvelope) => {
      const subs = this.server.subscribers.get(job.jobId);
      if (subs === undefined || subs.size === 0) return;
      for (const sub of subs) {
        void forwardEventToSubscriber(sub, env).catch(() => undefined);

Proposed fix

Delete subscriberBroadcaster and the broadcast field on WrapJobCtxArgs (and the runHandler construction), or hook it into a single live fan-out path.

Acceptance criteria

  • No unreachable broadcaster method remains and WrapJobCtxArgs has no unused field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions