Fix #99410: SocketIO Reconnect Web Interface #104235
@ -49,15 +49,16 @@ export default {
|
||||
flamencoVersion: DEFAULT_FLAMENCO_VERSION,
|
||||
backendURL: backendURL,
|
||||
}),
|
||||
|
||||
mounted() {
|
||||
window.app = this;
|
||||
this.fetchManagerInfo();
|
||||
|
||||
const sockStatus = useSocketStatus();
|
||||
this.$watch(() => sockStatus.isConnected, (isConnected) => {
|
||||
dr.sybren marked this conversation as resolved
|
||||
if (isConnected) {
|
||||
if (!isConnected) return;
|
||||
if (!sockStatus.wasEverDisconnected) return;
|
||||
this.socketIOReconnect();
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
@ -72,14 +73,14 @@ export default {
|
||||
},
|
||||
|
||||
socketIOReconnect() {
|
||||
dr.sybren marked this conversation as resolved
Outdated
Sybren A. Stüvel
commented
This function shouldn't be called here, as it does too much. It not only fetches the current version, but also writes to Comparing with This function shouldn't be called here, as it does too much. It not only fetches the current version, but also writes to `this.flamencoVersion`. This means that it overwrites the value that you want to compare against.
Comparing with `DEFAULT_FLAMENCO_VERSION` is *always* going to result in a difference, as the Manager will never return the string 'unknown'.
|
||||
this.fetchManagerInfo()
|
||||
if (this.flamencoVersion !== DEFAULT_FLAMENCO_VERSION || this.flamencoName !== DEFAULT_FLAMENCO_NAME ) {
|
||||
console.log(`Upgraded Flamenco Version: ${this.flamencoVersion}`);
|
||||
|
||||
// Reload the page
|
||||
const metaAPI = new API.MetaApi(getAPIClient())
|
||||
metaAPI.getVersion().then((version) => {
|
||||
Sybren A. Stüvel
commented
For debugging, it's better to log both versions here: the one that was stored on the webapp startup, and the one that was found now. That way you can see "upgraded from X to Y" in the JS console. For debugging, it's better to log both versions here: the one that was stored on the webapp startup, and the one that was found now. That way you can see "upgraded from X to Y" in the JS console.
|
||||
if (version.name === this.flamencoName && version.version == this.flamencoVersion)
|
||||
return;
|
||||
console.log(`Updated from ${this.flamencoVersion} to ${version.version}`);
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user
This should also check
sockStatus.wasEverDisconnected
, otherwise it'll also respond to the initial connection.