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 adding a Channel to a controller by calling Watch(), InjectStopChannel gets called with a value of nil instead of a real channel.
This appears to be because nothing sets the value of stop before Watch() gets called. The value of stop only gets set once the manager's Start() method is called.
Here's the order of operations:
Manager gets created
Controller gets created and added to the manager
Controller's Watch() method gets called with the new Channel as an argument
Manager's Start() method gets called, with a stop channel being passed in. This is the opportunity for a stop channel to be provided by a controller author.
The manager's Start() method calls each controller's Start() method, also passing through the stop channel.
At step 3, the manager's stop channel gets injected into the Channel. But the manager's stop channel doesn't get set until step 4, so at step 3 it has a nil value.
Workaround
The controller author can call InjectStopChannel directly and pass it the same channel they'll later pass to the manager's Start() method. But the InjectStopChannel method is clearly documented as not being intended for this purpose, nor is this approach helpful to the controller author.
The text was updated successfully, but these errors were encountered:
Problem
When adding a Channel to a controller by calling
Watch()
, InjectStopChannel gets called with a value ofnil
instead of a real channel.This appears to be because nothing sets the value of
stop
beforeWatch()
gets called. The value ofstop
only gets set once the manager'sStart()
method is called.Here's the order of operations:
Watch()
method gets called with the newChannel
as an argumentStart()
method gets called, with a stop channel being passed in. This is the opportunity for a stop channel to be provided by a controller author.Start()
method calls each controller'sStart()
method, also passing through the stop channel.At step 3, the manager's stop channel gets injected into the Channel. But the manager's stop channel doesn't get set until step 4, so at step 3 it has a
nil
value.Workaround
The controller author can call
InjectStopChannel
directly and pass it the same channel they'll later pass to the manager'sStart()
method. But theInjectStopChannel
method is clearly documented as not being intended for this purpose, nor is this approach helpful to the controller author.The text was updated successfully, but these errors were encountered: