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
Expected behavior
The disconnect state change (online -> offline) should be called through our registered callback.
Environment:
Package Version: [1.4.0]
Node.js Version: [20.11.1]
OS: [Ubuntu 20.04]
Additional context
The problem lies in the asynchronous callback in the AgvController.attach method:
private_attachAdapter(){this.debug("Invoking attach handler");this._agvAdapter.attach({attached: asyncinitialState=>{// this is an async callback// Ensure subscriptions on orders and instant actions are// registered with the broker before publishing the initial// state. A Master Control may observe this state to immediately// trigger initial instant actions or orders.this.updatePartialState(initialState,false);awaitthis._subscribeOnStarted();this._publishCurrentState();},});}
...
privateasync_subscribeOnStarted(){// First, subscribe to orders and instant actions.awaitthis.subscribe(Topic.Order,order=>this._processOrder(order));awaitthis.subscribe(Topic.InstantActions,actions=>this._processInstantActions(actions));// Ensure State is reported immediately once after client is online again.console.log(`_subscribeOnStarted register connection listener@ ${Date.now()}`);this.registerConnectionStateChange((currentState,prevState)=>{// this is called after all subscriptions are done, which may happen AFTER onStarted has returned, and after we registered our listenerif(currentState==="online"&&prevState!=="online"){this._publishCurrentState();}});this._setupPublishVisualizationInterval();}
I suggest you use a second private class property to store the callback used in _subscribeOnStarted instead of the public callback.
The text was updated successfully, but these errors were encountered:
Describe the bug
The AgvController._subscribeOnStarted method is asynchonrously overwriting user registered connection state listeners.
Is this a regression?
No
To Reproduce
Minimal steps to reproduce the behavior:
Expected behavior
The disconnect state change (online -> offline) should be called through our registered callback.
Environment:
Additional context
The problem lies in the asynchronous callback in the
AgvController.attach
method:I suggest you use a second private class property to store the callback used in _subscribeOnStarted instead of the public callback.
The text was updated successfully, but these errors were encountered: