mirror of
https://github.com/koush/scrypted.git
synced 2026-05-04 21:30:30 +01:00
snapshot: fix periodic snapshot timeout regression
This commit is contained in:
4
plugins/snapshot/package-lock.json
generated
4
plugins/snapshot/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/snapshot",
|
||||
"version": "0.2.39",
|
||||
"version": "0.2.40",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/snapshot",
|
||||
"version": "0.2.39",
|
||||
"version": "0.2.40",
|
||||
"dependencies": {
|
||||
"@types/node": "^20.10.6",
|
||||
"sharp": "^0.33.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/snapshot",
|
||||
"version": "0.2.39",
|
||||
"version": "0.2.40",
|
||||
"description": "Snapshot Plugin for Scrypted",
|
||||
"scripts": {
|
||||
"scrypted-setup-project": "scrypted-setup-project",
|
||||
|
||||
@@ -292,12 +292,13 @@ class SnapshotMixin extends SettingsMixinDeviceBase<Camera> implements Camera {
|
||||
if (periodicSnapshot && this.currentPicture) {
|
||||
const cp = this.currentPicture;
|
||||
debounced.catch(() => { });
|
||||
const timeout = options.timeout || 1000;
|
||||
try {
|
||||
picture = await (options.timeout ? timeoutPromise(options.timeout, debounced) : debounced);
|
||||
picture = await timeoutPromise(timeout, debounced);
|
||||
}
|
||||
catch (e) {
|
||||
if (options.timeout)
|
||||
this.debugConsole?.log(`Periodic snapshot took longer than ${options.timeout} seconds to retrieve, falling back to cached picture.`)
|
||||
if (e instanceof TimeoutError)
|
||||
this.debugConsole?.log(`Periodic snapshot took longer than ${timeout} seconds to retrieve, falling back to cached picture.`)
|
||||
|
||||
picture = cp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user