mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
Cleanup expired tokens at startup
This commit is contained in:
10
src/smapi.ts
10
src/smapi.ts
@@ -410,6 +410,16 @@ function bindSmapiSoapServiceToExpress(
|
||||
) {
|
||||
const sonosSoap = new SonosSoap(bonobUrl, linkCodes, smapiAuthTokens, clock, tokenStore);
|
||||
|
||||
// Clean up expired tokens on startup
|
||||
try {
|
||||
const cleaned = tokenStore.cleanupExpired(smapiAuthTokens);
|
||||
if (cleaned > 0) {
|
||||
logger.info(`Cleaned up ${cleaned} expired token(s) on startup`);
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error("Failed to cleanup expired tokens on startup", { error });
|
||||
}
|
||||
|
||||
// Clean up expired tokens every hour
|
||||
setInterval(() => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user