forked from Silverfish/proton-bridge
fix(GODT-2829): Sync Service fixes
Fix tracking of child jobs. The build stage splits the incoming work even further, but this was not reflected in the wait group counter. This also fixes an issue where the cache was cleared to late. Add more debug info for analysis. Refactor sync state interface in order to have persistent sync rate.
This commit is contained in:
@ -117,7 +117,11 @@ func (t *Handler) Execute(
|
||||
}
|
||||
|
||||
t.log.WithField("duration", time.Since(start)).Info("Finished user sync")
|
||||
t.syncFinishedCh <- err
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case t.syncFinishedCh <- err:
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -179,8 +183,12 @@ func (t *Handler) run(ctx context.Context,
|
||||
if err := t.syncState.SetMessageCount(ctx, totalMessageCount); err != nil {
|
||||
return fmt.Errorf("failed to store message count: %w", err)
|
||||
}
|
||||
|
||||
syncStatus.TotalMessageCount = totalMessageCount
|
||||
}
|
||||
|
||||
syncReporter.InitializeProgressCounter(ctx, syncStatus.NumSyncedMessages, syncStatus.TotalMessageCount)
|
||||
|
||||
if !syncStatus.HasMessages {
|
||||
t.log.Info("Syncing messages")
|
||||
|
||||
@ -198,6 +206,11 @@ func (t *Handler) run(ctx context.Context,
|
||||
t.log,
|
||||
)
|
||||
|
||||
stageContext.metadataFetched = syncStatus.NumSyncedMessages
|
||||
stageContext.totalMessageCount = syncStatus.TotalMessageCount
|
||||
|
||||
defer stageContext.Close()
|
||||
|
||||
t.regulator.Sync(ctx, stageContext)
|
||||
|
||||
// Wait on reply
|
||||
|
||||
Reference in New Issue
Block a user