fix(queue): reset projection list before each Register call (#10001)

# Which Problems Are Solved

if Zitadel was started using `start-from-init` or `start-from-setup`
there were rare cases where a panic occured when
`Notifications.LegacyEnabled` was set to false. The cause was a list
which was not reset before refilling.

# How the Problems Are Solved

The list is now reset before each time it gets filled.

# Additional Changes

Ensure all contexts are canceled for the init and setup functions for
`start-from-init- or `start-from-setup` commands.

# Additional Context

none
This commit is contained in:
Silvan
2025-06-02 10:16:13 +02:00
committed by adlerhurst
parent 2efb2fec7a
commit f065257e4f
3 changed files with 18 additions and 3 deletions

View File

@@ -43,6 +43,9 @@ func Register(
queue.ShouldStart()
}
// make sure the slice does not contain old values
projections = nil
q := handlers.NewNotificationQueries(queries, es, externalDomain, externalPort, externalSecure, fileSystemPath, userEncryption, smtpEncryption, smsEncryption)
c := newChannels(q)
projections = append(projections, handlers.NewUserNotifier(ctx, projection.ApplyCustomConfig(userHandlerCustomConfig), commands, q, c, otpEmailTmpl, notificationWorkerConfig, queue))