@homebridge-plugins/homebridge-govee 11.30.0-beta.0 → 11.30.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,7 @@ All notable changes to `@homebridge-plugins/homebridge-govee` will be documented
8
8
 
9
9
  - chore(ble): let noble apply its own adapter timeout instead of racing a second one
10
10
  - fix: restore aws brightness scaling, so lights reach the brightness asked for (#1262) (@gradyg21)
11
+ - fix: skip a periodic sync when the previous one is still running, so slow responses stop stacking up (#1256) (@schwaggy)
11
12
 
12
13
  ## v11.29.3 (2026-07-21)
13
14
 
package/lib/platform.js CHANGED
@@ -57,6 +57,9 @@ export default class {
57
57
  this.deviceConf = {}
58
58
  this.ignoredDevices = []
59
59
 
60
+ // Periodic syncs currently running, so a slow one is not started twice
61
+ this.syncsInFlight = new Set()
62
+
60
63
  // Make sure user is running Homebridge v1.5 or above
61
64
  if (!api.versionGreaterOrEqual?.('1.5.0')) {
62
65
  throw new Error(platformLang.hbVersionFail)
@@ -777,7 +780,7 @@ export default class {
777
780
 
778
781
  this.refreshBLEInterval = setInterval(async () => {
779
782
  try {
780
- await this.goveeBLESync()
783
+ await this.runPeriodicSync('BLE', () => this.goveeBLESync())
781
784
  } catch (err) {
782
785
  this.log.warn('[BLE] sync failed: %s', parseError(err))
783
786
  }
@@ -791,7 +794,7 @@ export default class {
791
794
  if (this.httpClient && httpSyncNeeded) {
792
795
  this.goveeHTTPSync()
793
796
  this.refreshHTTPInterval = setInterval(
794
- () => this.goveeHTTPSync(),
797
+ () => this.runPeriodicSync('HTTP', () => this.goveeHTTPSync()),
795
798
  this.config.httpRefreshTime * 1000,
796
799
  )
797
800
  }
@@ -800,7 +803,7 @@ export default class {
800
803
  const openApiRefresh = (this.config.openApiRefreshTime || this.config.httpRefreshTime) * 1000
801
804
  this.goveeOpenApiSync()
802
805
  this.refreshOpenApiInterval = setInterval(
803
- () => this.goveeOpenApiSync(),
806
+ () => this.runPeriodicSync('OPENAPI', () => this.goveeOpenApiSync()),
804
807
  openApiRefresh,
805
808
  )
806
809
 
@@ -820,7 +823,7 @@ export default class {
820
823
  // No need for await as catches its own errors, we poll specific models that need it
821
824
  this.goveeAWSSync(true)
822
825
  this.refreshAWSInterval = setInterval(
823
- () => this.goveeAWSSync(),
826
+ () => this.runPeriodicSync('AWS', () => this.goveeAWSSync()),
824
827
  60000,
825
828
  )
826
829
  }
@@ -1443,6 +1446,28 @@ export default class {
1443
1446
  }
1444
1447
  }
1445
1448
 
1449
+ /**
1450
+ * Run a periodic sync, skipping this run if the previous one is still going.
1451
+ *
1452
+ * The intervals fire on a timer regardless of how long a sync takes, and the
1453
+ * http request timeout and the default refresh interval are both thirty
1454
+ * seconds. A single slow response therefore guaranteed the next sync started
1455
+ * before the last had finished, and those stacked up - piling more requests
1456
+ * onto an endpoint that was already struggling (#1256).
1457
+ */
1458
+ async runPeriodicSync(name, sync) {
1459
+ if (this.syncsInFlight.has(name)) {
1460
+ this.log.debugWarn('[%s] %s', name, platformLang.syncStillRunning)
1461
+ return
1462
+ }
1463
+ this.syncsInFlight.add(name)
1464
+ try {
1465
+ await sync()
1466
+ } finally {
1467
+ this.syncsInFlight.delete(name)
1468
+ }
1469
+ }
1470
+
1446
1471
  async goveeAWSSync(allDevices = false) {
1447
1472
  const pollList = allDevices ? awsDevices : awsDevicesToPoll
1448
1473
  if (pollList.length === 0) {
@@ -130,6 +130,7 @@ export default {
130
130
  storageSetupErr: 'Could not setup storage client as',
131
131
  storageWriteErr: 'could not save accessory to file as',
132
132
  syncFail: 'sync failed as',
133
+ syncStillRunning: 'skipping this sync as the previous one has not finished yet',
133
134
  viaAL: 'via adaptive lighting',
134
135
  unknownCommand: 'unknown command in payload received',
135
136
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@homebridge-plugins/homebridge-govee",
3
3
  "alias": "Govee",
4
4
  "type": "module",
5
- "version": "11.30.0-beta.0",
5
+ "version": "11.30.0-beta.2",
6
6
  "description": "Homebridge plugin to integrate Govee devices into HomeKit.",
7
7
  "author": {
8
8
  "name": "bwp91",