Repository navigation
Conversation
…le throws AbstractService only cleared actionPromise on success. When start(), stop() or assemble() threw, the catch branch released the semaphore but left actionPromise pointing at the rejected promise, so every later startService/stopService/assembleService call returned that old rejection and the action never ran again — a service that failed once (e.g. database not reachable yet) could not be recovered without a process restart, and ServiceManager.watch() retries hit the same rejection unhandled. Clear actionPromise in the catch branches too, mirroring the success path. Adds tests covering the retry of all three actions after a throwing first attempt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10.
Problem
In
AbstractService, the success branch ofstartService/stopService/assembleServiceclearsactionPromise, but the.catchbranch only releases the semaphore. After onestart()that throws,actionPromisekeeps pointing at the rejected promise: the first call returnsfalse, but every later call takes the "already an active request" branch and returns that old rejection —start()never runs again.stopandassemblebehave the same way. A service that throws once (e.g. the database was not reachable yet) can never be started again without restarting the process, andServiceManager.watch()retries hit the same unhandled rejection.Fix
Clear
this.actionPromise = undefinedin the catch branches of all three methods, mirroring the success path. One line each; no behavior change for in-flight deduplication or for actions that returnfalsewithout throwing (that path already cleared the promise).Tests
New
tests/abstractService.spec.tswith a service whose start/stop/assemble throw on the first attempt and succeed on the second:promise rejected "Error: start failed" instead of resolving)Full package suite: 18/18 pass (15 existing + 3 new).
tsc --noEmitclean, eslint/prettier clean. Changeset included (@rosen-bridge/service-manager: patch).