mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
feat(BRIDGE-340): additional logging for label operations & bad events
This commit is contained in:
@ -355,6 +355,12 @@ func (s *Service) run(ctx context.Context) { //nolint gocyclo
|
||||
|
||||
case *onBadEventReq:
|
||||
s.log.Debug("Bad Event Request")
|
||||
// // Log remote label IDs stored in the local labelMap.
|
||||
s.labels.LogLabels()
|
||||
// Log the remote label IDs store in Gluon.
|
||||
if err := s.logRemoteMailboxIDsFromServer(ctx, s.connectors); err != nil {
|
||||
s.log.Warnf("Could not obtain remote mailbox IDs from server: %v", err)
|
||||
}
|
||||
err := s.removeConnectorsFromServer(ctx, s.connectors, false)
|
||||
req.Reply(ctx, nil, err)
|
||||
|
||||
@ -572,6 +578,16 @@ func (s *Service) addConnectorsToServer(ctx context.Context, connectors map[stri
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Service) logRemoteMailboxIDsFromServer(ctx context.Context, connectors map[string]*Connector) error {
|
||||
addrIDs := make([]string, 0, len(connectors))
|
||||
|
||||
for _, c := range connectors {
|
||||
addrIDs = append(addrIDs, c.addrID)
|
||||
}
|
||||
|
||||
return s.serverManager.LogRemoteLabelIDs(ctx, s.gluonIDProvider, addrIDs...)
|
||||
}
|
||||
|
||||
func (s *Service) removeConnectorsFromServer(ctx context.Context, connectors map[string]*Connector, deleteData bool) error {
|
||||
addrIDs := make([]string, 0, len(connectors))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user