Skip to content

fix: add 10-minute timeout to getSubscribedStoreData sync wait loop#1525

Merged
TheLastCicada merged 8 commits into
fix/parallel-store-creation-retryfrom
fix/sync-service-timeout
Mar 11, 2026
Merged

fix: add 10-minute timeout to getSubscribedStoreData sync wait loop#1525
TheLastCicada merged 8 commits into
fix/parallel-store-creation-retryfrom
fix/sync-service-timeout

Conversation

@TheLastCicada

@TheLastCicada TheLastCicada commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a 10-minute timeout (SYNC_TIMEOUT_MS = 600000) to the waitForSync loop in getSubscribedStoreData() (src/datalayer/syncService.js), consistent with the timeout pattern already used in the v2 getRegistryStoreIdFromSingleton.
  • Without this, any store that fails to sync causes an infinite blocking loop that hangs the entire sync process.
  • Extracts the poll interval into a named constant (SYNC_POLL_INTERVAL_MS) and exports SYNC_TIMEOUT_MS for callers that may want to reference it.

Test plan

  • Verified v1 integration tests pass (110 passing; 2 pre-existing failures in unit split/delete unrelated to this change)
  • Verified v2 integration tests pass (1225 passing; 1 pre-existing failure in org creation status tracking unrelated to this change)
  • Confirmed the sync timeout path only runs in production mode (USE_SIMULATOR=false), so simulator-based tests are unaffected
  • Manual verification with a stuck/slow-syncing store to confirm the timeout fires and throws the expected error

Note

Medium Risk
Changes the production waitForSync control flow to throw after 10 minutes instead of waiting indefinitely, which could surface new errors in slow-sync environments but prevents hangs.

Overview
Adds a bounded timeout to getSubscribedStoreData()’s waitForSync loop so a store that never reaches a synced state no longer blocks forever; it now throws after SYNC_TIMEOUT_MS (10 minutes).

Extracts the sync polling sleep into SYNC_POLL_INTERVAL_MS and exports SYNC_TIMEOUT_MS from syncService for reuse by callers.

Written by Cursor Bugbot for commit 7351d52. This will update automatically on new commits. Configure here.

TheLastCicada and others added 8 commits March 5, 2026 13:51
yao-pkg v6.13.1 has a compatibility issue with Node 24 where the
runtime prelude throws ENOENT instead of allowing the bindings
package to retry alternate paths for node_sqlite3.node. Upgrade to
v6.14.1 which adds proper Node 24 support, add the native addon as
a pkg asset as a fallback, and add a CI step that fails fast with
a helpful message if the sqlite3 path changes in the future.
Update esbuild override from 0.25.12 to 0.27.3 to match the
requirement of @yao-pkg/pkg@6.14.1, which requires esbuild@^0.27.3.
The previous override caused a forced downgrade that risked runtime
failures during the binary packaging step.

Also fix the Windows sqlite-path matrix value to use forward slashes
so the bash-based verification step correctly resolves the path, and
add shell: bash to the Copy sqlite3 step for consistency.
Start the built binary after copy sqlite3 step, poll /health for up to
60 seconds, and fail the build if the binary crashes or never responds.
Catches missing or mispathed node_sqlite3.node and other native addon
issues before artifacts are signed and uploaded.
pkg 6.14.1's prelude resolves native addons at
node_modules/sqlite3/build/node_sqlite3.node (without Release/) but
the file only exists at build/Release/. Add a prepare-pkg-assets step
to all build scripts that copies the .node file to the expected path
and include both paths in pkg.assets so the snapshot contains the
addon where the prelude looks for it.

Also remove deprecated Vercel pkg from global install since the build
scripts use the local @yao-pkg/pkg from node_modules/.bin.
wait PID || true always sets $? to 0 because true succeeds. Use
wait PID || EXIT_CODE=$? instead so the actual process exit code
is reported when the binary crashes during startup.
fix(CI): upgrade yao-pkg and fix Node 24 native addon resolution
The waitForSync loop in getSubscribedStoreData() could block
indefinitely if a store never finishes syncing. Add a 10-minute
deadline (matching the timeout used in the v2
getRegistryStoreIdFromSingleton) so a stuck store throws instead
of causing an infinite blocking loop.
@TheLastCicada TheLastCicada changed the base branch from develop to fix/parallel-store-creation-retry March 11, 2026 21:01
@TheLastCicada TheLastCicada merged commit ef06f60 into fix/parallel-store-creation-retry Mar 11, 2026
30 of 32 checks passed
@TheLastCicada TheLastCicada deleted the fix/sync-service-timeout branch March 11, 2026 21:01
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