Skip to content

Add Client.JobWaitFinalized - #1393

Open
brandur wants to merge 1 commit into
masterfrom
brandur-job-wait-finalized
Open

brandur wants to merge 1 commit into
masterfrom
brandur-job-wait-finalized

Conversation

@brandur

@brandur brandur commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Adds a helper Client.JobWaitFinalized that polls waiting for a job to
be finalized (completed, discarded, or cancelled) and returns it.

The existing subscription functionality isn't appropriate for this
because it only returns changes that occur within the existing client,
so a job worked elsewhere wouldn't be returned.

Implementation details:

  • Multiple calls to JobWaitFinalized share a single poll loop.

  • Polls every 250 ms.

  • A database and/or client change could add a notify signal that sends
    when a job is finalized, but that'd involve a more elaborate change,
    and would have downsides in that we'd have to be doing a lot of
    signaling even in case where no one's listening.

Adds a helper `Client.JobWaitFinalized` that polls waiting for a job to
be finalized (completed, discarded, or cancelled) and returns it.

The existing subscription functionality isn't appropriate for this
because it only returns changes that occur within the existing client,
so a job worked elsewhere wouldn't be returned.

Implementation details:

* Multiple calls to `JobWaitFinalized` share a single poll loop.

* Polls every 250 ms.

* A database and/or client change could add a notify signal that sends
  when a job is finalized, but that'd involve a more elaborate change,
  and would have downsides in that we'd have to be doing a lot of
  signaling even in case where no one's listening.
@brandur
brandur force-pushed the brandur-job-wait-finalized branch from ba5e6b3 to 8caf757 Compare September 26, 2026 03:13
@brandur
brandur requested a review from bgentry September 26, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant