You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we start the worker by calling the Start method, the application may fail due to AWS access rights or any AWS error, in that case we retry calling start couple of times. If retrying a certain amount of times is unsuccessful we handle the error and exit our program.
However we also have a signal listener which shuts down the application gracefully, and also calls Shutdown method. Considering our workers always failed to start due to failed initialize
When the Shutdown method inside the library is called, it attempts to close stop channel which was not yet created:
worker.go#L134
close(*w.stop)
Solution
I suggest to create the stop channel & and waitGroup in the first place when calling initialize method to avoid panics when calling the Shutdown method
Here's a small example of how our Start looks like:
The text was updated successfully, but these errors were encountered:
scirlig-ellation
changed the title
Create close channel first inside initialize method
Create close channel first inside initialize method
Jan 29, 2020
Background
When we start the worker by calling the
Start
method, the application may fail due to AWS access rights or any AWS error, in that case we retry calling start couple of times. If retrying a certain amount of times is unsuccessful we handle the error and exit our program.However we also have a signal listener which shuts down the application gracefully, and also calls
Shutdown
method. Considering our workers always failed to start due to failedinitialize
When the
Shutdown
method inside the library is called, it attempts to closestop
channel which was not yet created:worker.go#L134
Solution
I suggest to create the
stop
channel & andwaitGroup
in the first place when callinginitialize method
to avoid panics when calling theShutdown
methodHere's a small example of how our
Start
looks like:Start
The text was updated successfully, but these errors were encountered: