-
-
Notifications
You must be signed in to change notification settings - Fork 630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase snapshot handler warning timeout to 8000ms. #1055
Conversation
@@ -1025,7 +1025,7 @@ export class CameraController extends EventEmitter implements SerializableContro | |||
reject(HAPStatus.OPERATION_TIMED_OUT); | |||
}, 17000); | |||
timeout.unref(); | |||
}, 5000); | |||
}, 8000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This timeout is for the „slow to respond“ message. The problem with snapshot handlers is that they will block the accessory from receiving further request from the device.
Also currently, we do a 5000+17000 max timeout (after which we return a HAPStatue Timeout). If we really are increasing the timeout to 8s we might want to decrease the 17s one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opted to leave the one at 17s because it seems reasonable. I understand that they may block the accessory from receiving further requests - that’s the plugin developer’s problem, not Homebridge’s. I don’t want Homebridge telling me what I already know. 😄 In my use case, I know that they may take longer than 5 seconds to complete - that doesn’t make it wrong or invalid and it leads to unnecessary end-user questions. There’s currently no way to turn these off or configure them to more properly be tuned to an individual plugin’s needs. That’s for another day and then the plugin developer can decide how much alerting (or not) they want. That’s the right long-term answer, but in the short-term, I think this is reasonable.
TL;DR: I think 17s is good as it is, with a warning at the ~45% mark (8s) and a timeout at 17s (100% for the purposes of this conversation). A warning at the ~17% mark (5s) is overly aggressive. It’s a reasonable compromise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, thanks for explaining the rationale behind this change 👍
## v1.0.0 (2025-07-11) ### Breaking Changes - **The minimum Node.js version required is now `v18`.** - **Important notice:** Because of the cleanup of the Deprecated code, you will need to migrate you code base. - Remove the long-deprecated init(). - Deprecate Core, BridgedCore, legacy Camera characteristics. (#1058) (@hjdhjd) - For deprecated `Core` and `BridgedCore` see: https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore - Legacy code deprecation cleanup. (#1059) (@hjdhjd) - For deprecated `storagePath` switch to `HAPStorage.setCustomStoragePath`, `AudioCodec` switch to `AudioStreamingCodec`, `VideoCodec` switch to `H264CodecParameters`,`StreamAudioParams` switch to `AudioStreamingOptions`, `StreamVideoParams` switch to `VideoStreamingOptions`,`cameraSource` switch to `CameraController`. - Others deprecated code to highlight removed: `useLegacyAdvertiser`, `AccessoryLoader`, ### Fixed - Fix: Build Issues (#1041) (@NorthernMan54) - Fix: Ensure data is only transmitted on open and ready connections. (#1051) (@hjdhjd) - Fix: Ensure we check names using the full UTF-8 character set. (#1052) (@hjdhjd) - Fix: ConfiguredName (#1049) (@donavanbecker) - Fix: Manufacturer looking at checkName but should look at checkValue. (#1053) (@donavanbecker) ### Other Changes - Implement warning messages for invalid characters in names (#1009) (@NorthernMan54) - Mitigate event emitter "memory leak" warnings when a significant number of camera streaming events occur simultaneously (#1037) (@hjdhjd) - AdaptiveLightingController fix & improvement (#1038) (@Shaquu) - Minor fixes to recording logging and one change in logging. (#1040) (@hjdhjd) - Bridged core and core cleanup (#1048) (@Shaquu) - Increase snapshot handler warning timeout to 8000ms. (#1055) (@hjdhjd) - Cleanup and refactor getLocalNetworkInterface and address a potential edge case. (#1056) (@hjdhjd) - Correct log spacing - Updated and fixed `typedoc` config file - Updated dependencies ### Homebridge Dependencies - `@homebridge/ciao` @ `v1.3.0` - `bonjour-hap` @ `v3.8.0`
- **The minimum Node.js version required is now `v18`.** - **Important notice:** Because of the cleanup of the Deprecated code, you will need to migrate you code base. - Remove the long-deprecated init(). - Deprecate Core, BridgedCore, legacy Camera characteristics. (#1058) (@hjdhjd) - For deprecated `Core` and `BridgedCore` see: https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore - Legacy code deprecation cleanup. (#1059) (@hjdhjd) - For deprecated `storagePath` switch to `HAPStorage.setCustomStoragePath`, `AudioCodec` switch to `AudioStreamingCodec`, `VideoCodec` switch to `H264CodecParameters`,`StreamAudioParams` switch to `AudioStreamingOptions`, `StreamVideoParams` switch to `VideoStreamingOptions`,`cameraSource` switch to `CameraController`. - Others deprecated code to highlight removed: `useLegacyAdvertiser`, `AccessoryLoader`. - Fix: Naming for Characteristic.ProgramMode has been corrected from `PROGRAM_SCHEDULED_MANUAL_MODE_` to `PROGRAM_SCHEDULED_MANUAL_MODE` - Fix: Build Issues (#1041) (@NorthernMan54) - Fix: Ensure data is only transmitted on open and ready connections. (#1051) (@hjdhjd) - Fix: Ensure we check names using the full UTF-8 character set. (#1052) (@hjdhjd) - Fix: ConfiguredName (#1049) (@donavanbecker) - Fix: Manufacturer looking at checkName but should look at checkValue. (#1053) (@donavanbecker) - Implement warning messages for invalid characters in names (#1009) (@NorthernMan54) - Mitigate event emitter "memory leak" warnings when a significant number of camera streaming events occur simultaneously (#1037) (@hjdhjd) - AdaptiveLightingController fix & improvement (#1038) (@Shaquu) - Minor fixes to recording logging and one change in logging. (#1040) (@hjdhjd) - Bridged core and core cleanup (#1048) (@Shaquu) - Increase snapshot handler warning timeout to 8000ms. (#1055) (@hjdhjd) - Cleanup and refactor getLocalNetworkInterface and address a potential edge case. (#1056) (@hjdhjd) - Correct log spacing - Updated and fixed `typedoc` config file - Updated dependencies - `@homebridge/ciao` @ `v1.3.0` - `bonjour-hap` @ `v3.8.0`
## v1.0.0 (2024-07-10) ### Breaking Changes - **The minimum Node.js version required is now `v18`.** - **Important notice:** Because of the cleanup of the Deprecated code, you will need to migrate you code base. - Remove the long-deprecated init(). - Deprecate Core, BridgedCore, legacy Camera characteristics. (#1058) (@hjdhjd) - For deprecated `Core` and `BridgedCore` see: https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore - Legacy code deprecation cleanup. (#1059) (@hjdhjd) - For deprecated `storagePath` switch to `HAPStorage.setCustomStoragePath`, `AudioCodec` switch to `AudioStreamingCodec`, `VideoCodec` switch to `H264CodecParameters`,`StreamAudioParams` switch to `AudioStreamingOptions`, `StreamVideoParams` switch to `VideoStreamingOptions`,`cameraSource` switch to `CameraController`. - Others deprecated code to highlight removed: `useLegacyAdvertiser`, `AccessoryLoader`. - Fix: Naming for Characteristic.ProgramMode has been corrected from `PROGRAM_SCHEDULED_MANUAL_MODE_` to `PROGRAM_SCHEDULED_MANUAL_MODE` ### Fixed - Fix: Build Issues (#1041) (@NorthernMan54) - Fix: Ensure data is only transmitted on open and ready connections. (#1051) (@hjdhjd) - Fix: Ensure we check names using the full UTF-8 character set. (#1052) (@hjdhjd) - Fix: ConfiguredName (#1049) (@donavanbecker) - Fix: Manufacturer looking at checkName but should look at checkValue. (#1053) (@donavanbecker) ### Other Changes - Implement warning messages for invalid characters in names (#1009) (@NorthernMan54) - Mitigate event emitter "memory leak" warnings when a significant number of camera streaming events occur simultaneously (#1037) (@hjdhjd) - AdaptiveLightingController fix & improvement (#1038) (@Shaquu) - Minor fixes to recording logging and one change in logging. (#1040) (@hjdhjd) - Bridged core and core cleanup (#1048) (@Shaquu) - Increase snapshot handler warning timeout to 8000ms. (#1055) (@hjdhjd) - Cleanup and refactor getLocalNetworkInterface and address a potential edge case. (#1056) (@hjdhjd) - Correct log spacing - Updated and fixed `typedoc` config file - Updated dependencies ### Homebridge Dependencies - `@homebridge/ciao` @ `v1.3.0` - `bonjour-hap` @ `v3.8.0`
♻️ Current situation
When a camera image snapshot takes more than 5s to return an image to HAP-NodeJS a warning is generated, even though the HomeKit timeout appears to be at least 10s.
💡 Proposed solution
Revised the warning to generate at 8s instead of 5s, allowing developers a longer window without warnings.
⚙️ Release Notes
Updated image snapshot warning timeout to 8s (previously 5s).