Skip to content

fix: broadcast context and status code improvements#45

Merged
mrz1836 merged 1 commit intomainfrom
fix/broadcast-context-and-status
Apr 8, 2026
Merged

fix: broadcast context and status code improvements#45
mrz1836 merged 1 commit intomainfrom
fix/broadcast-context-and-status

Conversation

@shruggr
Copy link
Copy Markdown
Collaborator

@shruggr shruggr commented Apr 7, 2026

Summary

  • Detach broadcast goroutines from request context using context.WithoutCancel so client disconnect doesn't cancel in-flight teranode submissions
  • Use a shared broadcast context with 15s timeout per fan-out, cleaned up when all goroutines complete (not on early return)
  • Set StatusCode on TransactionStatus at construction in submitToTeranodeSync: pass through teranode HTTP codes, 503 for network failures, 504 for timeouts
  • Simplify collection loop from select-based to range over buffered channel

Test plan

  • Verify broadcasts propagate to all endpoints even when caller returns early on first success
  • Verify client disconnect mid-broadcast doesn't cancel remaining submissions
  • Verify StatusCode is non-zero in SSE events and webhook callbacks
  • Verify 503 for network failures, 504 for timeouts, passthrough for teranode 4xx/5xx
  • Existing tests pass, linter clean

- Detach broadcast goroutines from request context using WithoutCancel
  so client disconnect doesn't cancel in-flight broadcasts
- Use shared broadcast context with 15s timeout per fan-out operation,
  cancelled only when all goroutines complete
- Set StatusCode on TransactionStatus at construction in submitToTeranodeSync:
  pass through teranode HTTP codes, 503 for network failures, 504 for timeouts
- Simplify collection loop to range over buffered channel
@shruggr shruggr requested a review from mrz1836 as a code owner April 7, 2026 16:15
@github-actions github-actions bot added size/M Medium change (51–200 lines) bug-P3 Lowest rated bug, affects nearly none or low-impact labels Apr 7, 2026
@shruggr shruggr marked this pull request as draft April 7, 2026 16:23
@shruggr shruggr marked this pull request as ready for review April 8, 2026 13:27
Copy link
Copy Markdown
Collaborator

@mrz1836 mrz1836 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mrz1836 mrz1836 merged commit 7abfbe7 into main Apr 8, 2026
68 checks passed
@github-actions github-actions bot deleted the fix/broadcast-context-and-status branch April 8, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-P3 Lowest rated bug, affects nearly none or low-impact size/M Medium change (51–200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants