joeyhage / homebridge-spotify-speaker

Control Spotify playlists using a fake speaker accessory
MIT License
19 stars 3 forks source link

Possible race condition when refreshing tokens #11

Closed poblouin closed 2 years ago

poblouin commented 2 years ago

Describe The Bug: There is an interval in each accessories to refresh the tokens and they run roughly at the same time when you have multiple accessories.

[2/17/2022, 7:54:57 PM] [HomebridgeSpotifySpeaker] Access token has expired, attempting token refresh
[2/17/2022, 7:54:57 PM] [HomebridgeSpotifySpeaker] Access token has expired, attempting token refresh
[2/17/2022, 7:54:57 PM] [HomebridgeSpotifySpeaker] The access token has been refreshed!
[2/17/2022, 7:54:57 PM] [HomebridgeSpotifySpeaker] The access token has been refreshed!

This is not good because we could have issue since different process are writing to the same file. The interval could live on the platform instead.

To Reproduce:

Expected behavior:

Logs:

Show the Homebridge logs here, remove any sensitive information.

Plugin Config:

Show your Homebridge config.json here, remove any sensitive information.

Screenshots:

Environment:

poblouin commented 2 years ago

Fixed in #12