forked from Silverfish/proton-bridge
fix(GODT-2672): fix context cancelled when IMAP/SMTP parameters change is in progress.
This commit is contained in:
@ -668,7 +668,7 @@ func (s *Service) MailServerSettings(_ context.Context, _ *emptypb.Empty) (*Imap
|
|||||||
}, nil
|
}, 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.
|
s.log.
|
||||||
WithField("ImapPort", settings.ImapPort).
|
WithField("ImapPort", settings.ImapPort).
|
||||||
WithField("SmtpPort", settings.SmtpPort).
|
WithField("SmtpPort", settings.SmtpPort).
|
||||||
@ -681,6 +681,8 @@ func (s *Service) SetMailServerSettings(ctx context.Context, settings *ImapSmtpS
|
|||||||
|
|
||||||
defer func() { _ = s.SendEvent(NewChangeMailServerSettingsFinishedEvent()) }()
|
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 s.bridge.GetIMAPSSL() != settings.UseSSLForImap {
|
||||||
if err := s.bridge.SetIMAPSSL(ctx, settings.UseSSLForImap); err != nil {
|
if err := s.bridge.SetIMAPSSL(ctx, settings.UseSSLForImap); err != nil {
|
||||||
s.log.WithError(err).Error("Failed to set IMAP SSL")
|
s.log.WithError(err).Error("Failed to set IMAP SSL")
|
||||||
|
|||||||
Reference in New Issue
Block a user