mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-30 00:21:16 +00:00
[eventsub] Fix: Do not retry subscription on collision
resolves #TWITCH-BOT-7 Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
abe839df3a
commit
031ad331e4
1 changed files with 9 additions and 0 deletions
|
@ -298,6 +298,15 @@ func (c *Client) createEventSubSubscription(ctx context.Context, auth AuthType,
|
|||
OKStatus: http.StatusAccepted,
|
||||
Out: &resp,
|
||||
URL: "https://api.twitch.tv/helix/eventsub/subscriptions",
|
||||
ValidateFunc: func(opts ClientRequestOpts, resp *http.Response) error {
|
||||
if resp.StatusCode == http.StatusConflict {
|
||||
// This is fine: We needed that subscription, it exists
|
||||
return nil
|
||||
}
|
||||
|
||||
// Fallback to default handling
|
||||
return ValidateStatus(opts, resp)
|
||||
},
|
||||
}); err != nil {
|
||||
return nil, errors.Wrap(err, "executing request")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue