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.
📝 Description
Use case is basic redeploy moleculer app with consistent event flow.
On redeploy we have large amount of ServiceIsNotAvailable errors.
Minimal reproduction repository:
https://github.com/Ubitso/moleculer-sd-issue
🎯 Relevant issues
No
💎 Type of change
I've changed stop function in
service-broker
. Error was in regenerateLocalRawInfo in 'registry.js'. During broker stop process broker should send info packet with empty array of services. But it does send packet with current available services.So we should properly send info packet, and then after delay set
broker.stopping = true
, otherwise remote services will send requests to registred services when it's locked by 'broker.stopping = true'📜 Example code
I've tried to reproduce using test but i cant get same errors. I think it happens only if services is in separate processes.
Please look at my test, if possible to reproduce in one process please give me advice to how achieve that.
🚦 How Has This Been Tested?
I tested on my reproduction repo on versions 0.14.19 also on 0.14.21.
Also I fixed current test with fake timers because it starts to fail after my changes.
No
🏁 Checklist: