Skip to content

Commit

Permalink
fix(youtube): Catch auth issues that occur during polling #158
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxMD committed Jun 26, 2024
1 parent af517a0 commit c08494e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/backend/sources/AbstractSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@ export default abstract class AbstractSource extends AbstractComponent implement
} catch (e) {
this.logger.error('Error occurred while polling');
this.logger.error(e);
if(e.message.includes('Status code: 401')) {
this.authed = false;
this.authFailure = true;
}
this.emitEvent('statusChange', {status: 'Idle'});
this.polling = false;
throw e;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/tasks/heartbeatSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const createHeartbeatSourcesTask = (sources: ScrobbleSources, parentLogge
}
if (source.canPoll && !source.polling && (!source.authGated() || source.canTryAuth())) {
source.logger.info('Should be polling! Attempting to restart polling...', {leaf: 'Heartbeat'});
source.poll();
source.poll().catch(e => logger.error(e));
return 1;
}
}
Expand Down

0 comments on commit c08494e

Please sign in to comment.