Reprioritize notification services when updated.
This commit is contained in:
parent
257a4968ec
commit
414ca0a95c
2
main.go
2
main.go
@ -1211,6 +1211,8 @@ func actionConfigurationNotificationUpdate(w http.ResponseWriter, r *http.Reques
|
||||
notificationManager.AddService(*svc)
|
||||
}
|
||||
|
||||
notificationManager.Reprioritize()
|
||||
|
||||
w.Header().Add("Location", "/configuration")
|
||||
w.WriteHeader(302)
|
||||
} // }}}
|
||||
|
@ -39,6 +39,9 @@ func NewManager(logger *slog.Logger) (nm Manager) {
|
||||
func (nm *Manager) AddService(service Service) {
|
||||
service.SetExists(true)
|
||||
nm.services = append(nm.services, service)
|
||||
}
|
||||
|
||||
func (nm *Manager) Reprioritize() {
|
||||
slices.SortFunc(nm.services, func(a, b Service) int {
|
||||
if a.GetPrio() < b.GetPrio() {
|
||||
return -1
|
||||
|
Loading…
Reference in New Issue
Block a user