-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Race in moduleService
wrapper
#151
Comments
This looks cleaner. However, doesn't it break the |
I weakly prefer goroutine approach tbh. That listener will stay there registered forever, receiving updates.
Do you mean
It returns quickly, and doesn't wait for any state transition. (Well, implementation in |
Ah, I see now what you mean. Yes, you're right – we need to wait until services' Starting function finishes (succesfully or not). So listener would either react on |
(Btw, these are the only available transitions from starting state) |
We cannot use goroutine-approach that I preferred, it just doesn't work: We need to run I'm going to use listener-based approach, and fix |
moduleService
wrapper is responsible for waiting until all dependencies start, and then start the wrapped service. It does so by callingdskit/modules/module_service.go
Line 65 in de9a686
and then waiting for service to enter
Running
state:dskit/modules/module_service.go
Line 70 in de9a686
However if the wrapped service is so fast that it ends before
AwaitRunning
call, thenAwaitRunning
returns errorinvalid service state: Terminated, expected: Running
.We can solve this by starting
AwaitRunning
beforeStartAsync
(in separate goroutine), or adding a listener to the service instead and wait for any transition away fromStarting
state.The text was updated successfully, but these errors were encountered: