Skip to content

fix(api): clean up stale waiting tasks - #2351

Open
vavo wants to merge 1 commit into
livepeer:masterfrom
vavo:notrius/task-1670-cleanup-stale-tasks
Open

fix(api): clean up stale waiting tasks#2351
vavo wants to merge 1 commit into
livepeer:masterfrom
vavo:notrius/task-1670-cleanup-stale-tasks

Conversation

@vavo

@vavo vavo commented Jul 30, 2026

Copy link
Copy Markdown

What does this pull request do. Explain your changes. (required)

Fixes #1670 by cleaning up tasks that remain in the waiting phase indefinitely and preventing new tasks from being added when a user has reached the pending-task limit.

Specific updates (required)

  • Add a task-cleanup job for first-attempt tasks stuck in waiting for more than six hours.
  • Mark stale tasks as failed through the existing scheduler failure path.
  • Update related output assets and preserve existing task and asset webhook behavior.
  • Protect cleanup updates with an allowed-phase check so a concurrent task result cannot be overwritten.
  • Enforce queue capacity for scheduler-created tasks.
  • Add configurable task-cleanup and task-cleanup-limit CLI options.
  • Add focused tests for cleanup behavior and job registration.

How did you test each of these updates (required)

  • Prettier validation.
  • API TypeScript check.
  • Focused cleanup and job tests under Node 22.
  • Scheduler/database integration tests with real Postgres and RabbitMQ services.
  • Full API source test suite: 506 tests passed.

The repository-wide Jest command also discovers generated dist tests. Those artifact tests fail because generated schema files are not available in dist; the source test suite passes.

Does this pull request close any open issues?

Fixes #1670

Screenshots (optional)

Not applicable.

Checklist

  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

The `vercel.json` schema validation failed with the following message: should NOT have additional property `public`

Learn More: https://vercel.com/docs/concepts/projects/project-configuration

@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
livepeer-studio Error Error Jul 30, 2026 10:30pm

Request Review

@vavo
vavo force-pushed the notrius/task-1670-cleanup-stale-tasks branch from 1b6f6f8 to 3eb3dae Compare July 30, 2026 22:40
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

@vavo is attempting to deploy a commit to the Livepeer Team on Vercel.

A member of the Team first needs to authorize it.

@vavo

vavo commented Jul 30, 2026

Copy link
Copy Markdown
Author

Hey guys, this is my first PR for your repo. Although I've read your documentation on contributing , PR template and Code of Conduct, detailed feedback on what did I miss, what to do better, etc is more than welcome.

Also if there is a specific issue(s) you'd like to help with, let me know, I can have a look. Thanks!

@vavo
vavo marked this pull request as ready for review July 30, 2026 22:41
@vavo
vavo requested review from a team as code owners July 30, 2026 22:41
@rickstaa
rickstaa requested a review from seanhanca August 1, 2026 07:32
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.

Add cleanup for waiting tasks and reject adding more tasks

1 participant