mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2026-02-12 20:08:33 +00:00
GODT-2085: Use time.Since, structured logging
This commit is contained in:
@ -179,7 +179,8 @@ func syncLabels(ctx context.Context, apiLabels map[string]liteapi.Label, updateC
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func syncMessages( //nolint:funlen
|
// nolint:funlen
|
||||||
|
func syncMessages(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
userID string,
|
userID string,
|
||||||
client *liteapi.Client,
|
client *liteapi.Client,
|
||||||
@ -199,12 +200,15 @@ func syncMessages( //nolint:funlen
|
|||||||
return fmt.Errorf("failed to get message IDs to sync: %w", err)
|
return fmt.Errorf("failed to get message IDs to sync: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Track the amount of time to process all the messages.
|
||||||
syncStartTime := time.Now()
|
syncStartTime := time.Now()
|
||||||
defer func() {
|
defer func() { logrus.WithField("duration", time.Since(syncStartTime)).Info("Message sync completed") }()
|
||||||
syncFinishTime := time.Now()
|
|
||||||
logrus.Infof("Message sync completed in %v", syncFinishTime.Sub(syncStartTime))
|
logrus.WithFields(logrus.Fields{
|
||||||
}()
|
"messages": len(messageIDs),
|
||||||
logrus.Infof("Starting message sync with syncWorkers=%v (numCpu=%v) for %v messages", syncWorkers, runtime.NumCPU(), len(messageIDs))
|
"workers": syncWorkers,
|
||||||
|
"numCPU": runtime.NumCPU(),
|
||||||
|
}).Info("Starting message sync")
|
||||||
|
|
||||||
// Create the flushers, one per update channel.
|
// Create the flushers, one per update channel.
|
||||||
flushers := make(map[string]*flusher, len(updateCh))
|
flushers := make(map[string]*flusher, len(updateCh))
|
||||||
|
|||||||
Reference in New Issue
Block a user