downstream: add hard limit on Web Push subscriptions
Each subscription comes with the cost of a HTTP request when broadcasting a message.
This commit is contained in:
parent
cffdbc16b4
commit
6fa8a1f30a
@ -3336,6 +3336,13 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
|
||||
}}
|
||||
}
|
||||
|
||||
if len(subs) > 25 {
|
||||
return ircError{&irc.Message{
|
||||
Command: "FAIL",
|
||||
Params: []string{"WEBPUSH", "INTERNAL_ERROR", subcommand, "Too many subscriptions"},
|
||||
}}
|
||||
}
|
||||
|
||||
oldSub := findWebPushSubscription(subs, endpoint)
|
||||
if oldSub != nil {
|
||||
// Update the old subscription instead of creating a new one
|
||||
|
Loading…
Reference in New Issue
Block a user