Skip to content

Fix flaky ClickHouse test: reset claimed requests on QStash failure#1202

Closed
BilalG1 wants to merge 1 commit into
devfrom
clickhouse-flaky-fix-1
Closed

Fix flaky ClickHouse test: reset claimed requests on QStash failure#1202
BilalG1 wants to merge 1 commit into
devfrom
clickhouse-flaky-fix-1

Conversation

@BilalG1
Copy link
Copy Markdown
Collaborator

@BilalG1 BilalG1 commented Feb 16, 2026

Summary

  • When upstash.batchJSON() fails in the poller's batch path, reset the claimed OutgoingRequest rows by setting startedFulfillingAt back to NULL
  • This allows requests to be re-claimed on the next poller iteration instead of staying stuck forever

Theory

When the batch QStash call fails, the catch block captures the error but does NOT unclaim the requests. They're stuck with startedFulfillingAt IS NOT NULL. No new OutgoingRequest is created (dedup key conflict only checks NULL). The test deadlocks: the first sync never completes, and the test waits forever.

Test plan

  • CI should pass on this branch
  • The "Updates to user are synced to ClickHouse" test should stop intermittently timing out

When upstash.batchJSON() fails, the catch block captures the error
but does NOT unclaim the requests — they stay stuck with
startedFulfillingAt set. No new OutgoingRequest is created (dedup
key conflict only checks NULL startedFulfillingAt). This can cause
tests to deadlock waiting for a sync that never completes.

Reset startedFulfillingAt to NULL in the catch block so requests
can be re-claimed on the next poller iteration.
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 16, 2026

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

Project Deployment Actions Updated (UTC)
stack-backend Ready Ready Preview, Comment Feb 16, 2026 8:30pm
stack-dashboard Ready Ready Preview, Comment Feb 16, 2026 8:30pm
stack-demo Ready Ready Preview, Comment Feb 16, 2026 8:30pm
stack-docs Ready Ready Preview, Comment Feb 16, 2026 8:30pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 16, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch clickhouse-flaky-fix-1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@BilalG1 BilalG1 closed this Feb 16, 2026
@BilalG1 BilalG1 deleted the clickhouse-flaky-fix-1 branch February 16, 2026 20:51
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