fix(GODT-2672): fix context cancelled when IMAP/SMTP parameters change is in progress.

This commit is contained in:
Xavier Michelon
2023-05-31 08:10:59 +02:00
parent 11f55b59a9
commit 0eab1c0c2b

View File

@ -668,7 +668,7 @@ func (s *Service) MailServerSettings(_ context.Context, _ *emptypb.Empty) (*Imap
}, nil
}
func (s *Service) SetMailServerSettings(ctx context.Context, settings *ImapSmtpSettings) (*emptypb.Empty, error) {
func (s *Service) SetMailServerSettings(_ context.Context, settings *ImapSmtpSettings) (*emptypb.Empty, error) {
s.log.
WithField("ImapPort", settings.ImapPort).
WithField("SmtpPort", settings.SmtpPort).
@ -681,6 +681,8 @@ func (s *Service) SetMailServerSettings(ctx context.Context, settings *ImapSmtpS
defer func() { _ = s.SendEvent(NewChangeMailServerSettingsFinishedEvent()) }()
ctx := context.Background() // async operation, we cannot use the context provided by gRPC.
if s.bridge.GetIMAPSSL() != settings.UseSSLForImap {
if err := s.bridge.SetIMAPSSL(ctx, settings.UseSSLForImap); err != nil {
s.log.WithError(err).Error("Failed to set IMAP SSL")