Closed mdingena closed 3 years ago
Will need to investigate this further, but noticed an issue that would cause the refresh to only occur once.
I believe the expiration is 30 minutes, so that could explain the situation here.
This appears to be fixed in v1.1.0 🎉
This issue has resurfaced. The bot crashes roughly every hour as seen in my error logging: Between 19 and 20 times per day for the last week.
Context
When the bot starts, it will receive an access token with which it can create a websocket connection. It seems that this websocket connecation expires roughly every 10 minutes, and
js-tale
diligently recreates the connection automatically.But after 6 to 7 recreations (so after about an hour) the next recreation will fail with a
401 Unauthorized
status code. Worse, this exception is unhandled which means the whole bot comes crashing down.Observation
Desired outcome
js-tale
uses the API's refresh token to request a new access token when the current access token is about to expire. Refreshing the access token will allow the bot to keep recreating websockets, so that it can run indefinitely.