This one's related to #549. Although the most proximate problem in that
repro code is that there was no error check when calling Start, it did
reveal a legitimate problem in that the River client will panic in case
StopAndCancel is called before Start because workCancel was never
set.
Here, initialize workCancel in the client's constructor. During normal
operation this will be overwritten almost immediately on Start as the
client starts up, but in case Start was never called or didn't run
successfully, it provides a function for StopAndCancel to call so that
it doesn't panic.
This one's related to #549. Although the most proximate problem in that repro code is that there was no error check when calling
Start
, it did reveal a legitimate problem in that the River client will panic in caseStopAndCancel
is called beforeStart
becauseworkCancel
was never set.Here, initialize
workCancel
in the client's constructor. During normal operation this will be overwritten almost immediately onStart
as the client starts up, but in caseStart
was never called or didn't run successfully, it provides a function forStopAndCancel
to call so that it doesn't panic.Fixes #549.