Skip to content

Conversation

@nitsujlangston
Copy link
Member

  • ✅ Unlimited restarts - Workers will continuously restart on crash
  • ✅ Abnormal exit only - Only restarts on crashes (code !== 0 or signal)
  • ✅ 5-second delay - Fixed 5-second delay before each restart (hardcoded
    )
  • ✅ No backoff - Consistent 5-second delay, no exponential backoff
  • ✅ Shutdown protection - Workers will NOT restart during service
    shutdown

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements worker process restart functionality with automatic recovery from crashes. Workers now restart after a 5-second delay when they exit abnormally, while graceful shutdowns and service stops are respected.

Key changes:

  • Workers now automatically restart after crashes with a fixed 5-second delay
  • Added tracking of worker IDs and restart counts across restarts
  • Shutdown protection prevents restarts during service termination

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/bitcore-node/src/services/worker.ts Implemented worker restart logic with exit handlers, restart scheduling, and shutdown protection
packages/bitcore-node/test/unit/services/worker.spec.ts Added comprehensive test suite covering restart scenarios, timing, edge cases, and error conditions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kajoseph kajoseph merged commit ec1f264 into bitpay:master Dec 29, 2025
15 of 16 checks passed
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.

2 participants