mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2026-02-04 08:18:34 +00:00
fix(GODT-3124): Handling of sync child jobs
Improve the handling of sync child jobs to ensure it behaves correctly in all scenarios. The sync service now uses a isolated context to avoid all the pipeline stages shutting down before all the sync tasks have had the opportunity to run their course. The job waiter now immediately starts with a counter of 1 and waits until all the child and the parent job finish before considering the work to be finished. Finally, we also handle the case where a sync job can't be queued because the calling context has been cancelled.
This commit is contained in:
@ -307,7 +307,7 @@ func newBridge(
|
||||
bridge.heartbeat.init(bridge, heartbeatManager)
|
||||
}
|
||||
|
||||
bridge.syncService.Run(bridge.tasks)
|
||||
bridge.syncService.Run()
|
||||
|
||||
return bridge, nil
|
||||
}
|
||||
@ -451,6 +451,8 @@ func (bridge *Bridge) Close(ctx context.Context) {
|
||||
logrus.WithError(err).Error("Failed to close servers")
|
||||
}
|
||||
|
||||
bridge.syncService.Close()
|
||||
|
||||
// Stop all ongoing tasks.
|
||||
bridge.tasks.CancelAndWait()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user