Skip to content

fix: stop /admin sync status from timing out - #1162

Merged
Klakurka merged 1 commit into
masterfrom
claude/friendly-johnson-73w093
Nov 26, 2026
Merged

Klakurka merged 1 commit into
masterfrom
claude/friendly-johnson-73w093

Conversation

@Klakurka

@Klakurka Klakurka commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

The unpriced-txs count (prices: { none: {} } -> NOT IN subquery over the whole Transaction table) ran inside the request and outlasted the reverse proxy's timeout, so the client got an HTML error page and failed parsing it as JSON.

  • Count unpriced txs in the background with a NOT EXISTS anti-join, share one in-flight query, cache it for 5 min, and return the last finished count (null while the first one runs).
  • Replace the four Address groupBy scans with a single aggregate query.
  • Client: report non-JSON responses as an HTTP status instead of a JSON parse error, and show "counting…" until the first count is available.

Summary by CodeRabbit

  • Bug Fixes
    • Sync status now provides a clearer message when the server returns an unexpected response.
    • The unpriced-transactions indicator shows “counting…” until both the count and its check time are available.
  • Improvements
    • Sync status continues to display the last completed unpriced-transaction count while an updated count is being prepared.

The unpriced-txs count (prices: { none: {} } -> NOT IN subquery over the
whole Transaction table) ran inside the request and outlasted the reverse
proxy's timeout, so the client got an HTML error page and failed parsing it
as JSON.

- Count unpriced txs in the background with a NOT EXISTS anti-join, share
  one in-flight query, cache it for 5 min, and return the last finished
  count (null while the first one runs).
- Replace the four Address groupBy scans with a single aggregate query.
- Client: report non-JSON responses as an HTTP status instead of a JSON
  parse error, and show "counting…" until the first count is available.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019G564hvGkZJY3UCe17WV6u
@Klakurka Klakurka self-assigned this Nov 26, 2026
@Klakurka Klakurka added the bug Something isn't working label Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The sync status service now refreshes unpriced-transaction counts in the background and collects address statistics with a grouped query. The admin component handles non-JSON responses and displays “counting…” while count data is unavailable.

Changes: Sync status

Layer / File(s) Summary
Service status data and refresh
services/syncStatusService.ts
The service returns nullable cached count fields and refreshes unpriced-transaction counts in the background. It groups address statistics in one SQL query and converts per-network results to numbers, defaulting missing values to zero.
Admin status loading and display
components/Admin/SyncStatus.tsx
The component parses response text as JSON and reports the HTTP status, status text, and “non-JSON response” when parsing fails. It displays “counting…” when either count field is null.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant SyncStatus
  participant fetchSyncStatus
  participant SQLDatabase
  SyncStatus->>fetchSyncStatus: Load sync status
  fetchSyncStatus->>SQLDatabase: Query grouped address statistics
  fetchSyncStatus->>SQLDatabase: Start unpriced-count refresh
  SQLDatabase-->>fetchSyncStatus: Return address statistics
  fetchSyncStatus-->>SyncStatus: Return status with cached count or null
  SQLDatabase-->>fetchSyncStatus: Complete unpriced-count query
Loading
Merge Risk: Minimal · up to ee320

The change keeps the admin sync status endpoint from blocking on a slow count query and shows "counting…" until the first count completes. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix: stop /admin sync status from timing out" matches the main change. The PR moves the unpriced-transaction count to a background query, which stops the request from exceeding the reverse …
Description check Passed The description states the problem (the unpriced-txs count ran inside the request and exceeded the reverse proxy timeout), lists the backend and client changes, and explains the new null and counting …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix: stop /admin sync status from timing out" matches the main change. The PR moves the unpriced-transaction count to a background query, which stops the request from exceeding the reverse proxy timeout. The title is short, specific, and follows a conventional commit style.

Full details: Description check

Explanation

The description states the problem (the unpriced-txs count ran inside the request and exceeded the reverse proxy timeout), lists the backend and client changes, and explains the new null and counting behavior. It does not follow the repository template. It has no "Related to #" reference, no "Depends on" checklist, no separate "Description" section headed as the template requires, and no "Test plan" section. These are missing sections, but the core content is present.

Resolution

Optional improvements: add the "Related to #" issue reference (PR #1162 or the linked issue), add a "Depends on" entry if applicable, and add a "Test plan" section describing how the change was verified (for example, testing /admin with a large Transaction table, and testing the non-JSON response path).

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c2971fe9-8ba3-454d-b9f0-5259a83787b5
Commits

Reviewing files that changed from the base of the PR and between 1c83cf2 and ee320d2.

Files selected for processing: 2

  • components/Admin/SyncStatus.tsx
  • services/syncStatusService.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@Klakurka
Klakurka merged commit 013d307 into master Nov 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants