mirror of
https://github.com/FoxxMD/multi-scrobbler.git
synced 2026-09-03 05:10:00 +03:00
fix(player state): Fix stale/dead logic checks
* Stale should not reset to stale when status is orphaned * Dead check should be in seconds, not minutes
This commit is contained in:
@@ -62,7 +62,7 @@ export abstract class AbstractPlayerState {
|
||||
|
||||
checkStale() {
|
||||
const isStale = this.isUpdateStale();
|
||||
if (isStale && this.calculatedStatus !== CALCULATED_PLAYER_STATUSES.stale) {
|
||||
if (isStale && ![CALCULATED_PLAYER_STATUSES.stale, CALCULATED_PLAYER_STATUSES.orphaned].includes(this.calculatedStatus)) {
|
||||
this.calculatedStatus = CALCULATED_PLAYER_STATUSES.stale;
|
||||
this.logger.debug(`Stale after no Play updates for ${Math.abs(dayjs().diff(this.playLastUpdatedAt, 'seconds'))} seconds`);
|
||||
// end current listening sessions
|
||||
@@ -76,7 +76,7 @@ export abstract class AbstractPlayerState {
|
||||
}
|
||||
|
||||
isDead() {
|
||||
return dayjs().diff(this.stateLastUpdatedAt, 'minutes') >= this.stateIntervalOptions.orphanedInterval * 2;
|
||||
return dayjs().diff(this.stateLastUpdatedAt, 'seconds') >= this.stateIntervalOptions.orphanedInterval * 2;
|
||||
}
|
||||
|
||||
checkOrphaned() {
|
||||
|
||||
Reference in New Issue
Block a user