Bump update time on success in network.broadcastWebPush

Allows us to skip checks when the client sends WEBPUSH REGISTER
and avoid pruning subscriptions that still work fine.
This commit is contained in:
Simon Ser 2023-03-17 00:03:48 +01:00
parent 93af53c91d
commit a14ea80cb9

View File

@ -516,6 +516,11 @@ func (net *network) broadcastWebPush(msg *irc.Message) {
}
} else if err != nil {
net.logger.Printf("failed to send Web push notification to endpoint %q: %v", sub.Endpoint, err)
} else {
// On success, bump the subscription's update time
if err := net.user.srv.db.StoreWebPushSubscription(ctx, net.user.ID, net.ID, &sub); err != nil {
net.logger.Printf("failed to store Web push subscription: %v", err)
}
}
}
}