Skip to content

Commit

Permalink
fix(networkadvertisement): Ensure that there's only one scheduled net…
Browse files Browse the repository at this point in the history
…workStateCheck
  • Loading branch information
Hypfer committed Feb 24, 2023
1 parent 7bd7534 commit 0af4703
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/lib/NetworkAdvertisementManager.js
Expand Up @@ -65,6 +65,8 @@ class NetworkAdvertisementManager {
this.setUpBonjour();

this.ipAddresses = Tools.GET_CURRENT_HOST_IP_ADDRESSES().sort().join();

clearTimeout(this.networkStateCheckTimeout);
this.networkStateCheckTimeout = setTimeout(() => {
this.checkNetworkStateAndReschedule();
}, NETWORK_STATE_CHECK_INTERVAL);
Expand Down Expand Up @@ -214,6 +216,8 @@ class NetworkAdvertisementManager {
Logger.warn("Error while restarting NetworkAdvertisementManager due to network state change", err);
});
} else {
clearTimeout(this.networkStateCheckTimeout);

this.networkStateCheckTimeout = setTimeout(() => {
this.checkNetworkStateAndReschedule();
}, NETWORK_STATE_CHECK_INTERVAL);
Expand Down

0 comments on commit 0af4703

Please sign in to comment.