From ab9712b05b4c9395258b4041003678fbd399f23c Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Mon, 17 Jan 2022 21:28:33 +0100 Subject: [PATCH] Reset cache if token expire --- app/Tasks/CurrentSongTask.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Tasks/CurrentSongTask.ts b/app/Tasks/CurrentSongTask.ts index 6a8fa5f..1f95bb6 100644 --- a/app/Tasks/CurrentSongTask.ts +++ b/app/Tasks/CurrentSongTask.ts @@ -1,11 +1,12 @@ import Logger from '@ioc:Adonis/Core/Logger' -import { getCurrentPlayingFromSpotify, getSpotifyAccount } from 'App/Utils/SongUtils' +import { getCurrentPlayingFromSpotify, getSpotifyAccount, resetCurrentSongCache } from 'App/Utils/SongUtils' const MS = 1000 let taskId async function SpotifyCurrentListeningWatcher(): Promise { - if ((await getSpotifyAccount()).access_token === '') return + if ((await getSpotifyAccount()).access_token === '') + await resetCurrentSongCache() await getCurrentPlayingFromSpotify() }