feat(GODT-2828): Increase sync progress report frequency

We now report sync progress after a batch completes each stage.
This commit is contained in:
Leander Beernaert
2023-08-29 13:24:31 +02:00
parent f7252ed40e
commit a6c20f698c
9 changed files with 34 additions and 6 deletions

View File

@ -108,6 +108,10 @@ func (j *Job) onError(err error) {
j.cancel()
}
func (j *Job) onStageCompleted(ctx context.Context, count int64) {
j.syncReporter.OnProgress(ctx, count)
}
func (j *Job) onJobFinished(ctx context.Context, lastMessageID string, count int64) {
defer j.wg.Done()
@ -219,6 +223,10 @@ func (s *childJob) onFinished(ctx context.Context) {
s.job.downloadCache.DeleteAttachments(s.cachedAttachmentIDs...)
}
func (s *childJob) onStageCompleted(ctx context.Context) {
s.job.onStageCompleted(ctx, s.messageCount)
}
func (s *childJob) checkCancelled() bool {
err := s.job.ctx.Err()
if err != nil {