Skip to content

Commit aee23f7

Browse files
committed
fix(chrome): Remove device if it fails to refresh after 6 retries
1 parent 57b5528 commit aee23f7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/backend/sources/ChromecastSource.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,17 @@ export class ChromecastSource extends MemorySource {
288288
let apps: PlatformApplication[];
289289
try {
290290
apps = await getCurrentPlatformApplications(v.platform);
291+
v.retries = 0;
291292
} catch (e) {
292293
v.logger.warn(new ErrorWithCause('Could not refresh applications', {cause: e}));
293294
const validationError = findCauseByReference(e, ContextualValidationError);
294295
if(validationError && validationError.data !== undefined) {
295296
v.logger.warn(JSON.stringify(validationError.data));
296297
}
298+
v.retries++;
299+
if(v.retries >= 6) {
300+
this.removeApplications(k, 'Unable to refresh application more than 6 times consecutively! If this device comes back online it will be re-added on next heartbeat.');
301+
}
297302
continue;
298303
}
299304

0 commit comments

Comments
 (0)