Skip to content

Sync back-off: stop hammering IBKR after failures (fixes 1025 lockout) - #38

Merged
joaoguimaraespro merged 1 commit into
mainfrom
fix/ibkr-lockout
Oct 4, 2026
Merged

joaoguimaraespro merged 1 commit into
mainfrom
fix/ibkr-lockout

Conversation

@joaoguimaraespro

Copy link
Copy Markdown
Owner

Problem

IBKR answered 1025 "Too many failed attempts" and blocked the Flex token. The server logs show repeated SendRequest calls. Three causes added up:

  1. The scheduler decides "due" from the last successful sync only. A failing IBKR connection was retried every 30 minutes, all day.
  2. Backfill probing (IBKR: don't fail the sync on Flex 1003 (history before the account existed) #29/IBKR: later syncs no longer fail with 1003 #35) could spend up to ~11 failed requests in one sync.
  3. 1025 is undocumented and was treated as a generic error.

Changes

  • SyncSchedule (pure, unit tested) decides when a connection is due. After a failed attempt it waits 6 h for IBKR, 2 h for others, and 12 h after a lockout (1025 / "too many failed attempts" in the job's errors). The normal cadence is unchanged. BrokerSyncService loads the last finished job of the past 2 days per connection to apply it.
  • 1025 gets its own temporary error explaining the pause and suggesting a new token if it persists. The UI shows a translated hint that also tells the user not to press Sync meanwhile, since that extends the block.
  • Backfill spends at most 4 failed requests per sync. The rest of the history comes in later syncs.

Test plan

  • New SyncScheduleTests: back-off after a failure, 12 h lockout pause, normal cadence, lockout detection
  • New: 1025 is reported as temporary after a single request
  • Updated: give-up after ≤ 4 failed probes
  • Integrations.Tests, Integration (Portfolio), web unit tests 52/52

@joaoguimaraespro
joaoguimaraespro merged commit 3ecb31d into main Oct 4, 2026
7 checks passed
@joaoguimaraespro
joaoguimaraespro deleted the fix/ibkr-lockout branch October 4, 2026 18:22
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