[eventsub] Fix: Stop subscription-retries when client is closed

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-12-16 12:52:54 +01:00
parent 12f16db1ac
commit 8b3d3bdc98
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5

View file

@ -421,6 +421,12 @@ func (e *EventSubSocketClient) retryBackgroundSubscribe(st eventSubSocketSubscri
WithMaxTotalTime(retrySubscribeMaxTotal).
WithMinIterationTime(retrySubscribeMinWait).
Retry(func() error {
if err := e.runCtx.Err(); err != nil {
// Our run-context was cancelled, stop retrying to subscribe
// to topics as this client was closed
return backoff.NewErrCannotRetry(err)
}
return e.subscribe(st)
})
if err != nil {