mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
Other: Fix user sync leaks/race conditions
This fixes various race conditions and leaks related to the user's sync and API event stream. It was possible for a sync/stream to begin after a user was already closed; this change prevents that by managing the goroutines related to sync/stream within cancellable groups.
This commit is contained in:
@ -332,11 +332,9 @@ func (bridge *Bridge) Close(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// Close all users.
|
||||
if err := bridge.users.IterValuesErr(func(user *user.User) error {
|
||||
return user.Close()
|
||||
}); err != nil {
|
||||
logrus.WithError(err).Error("Failed to close users")
|
||||
}
|
||||
bridge.users.IterValues(func(user *user.User) {
|
||||
user.Close()
|
||||
})
|
||||
|
||||
// Close the focus service.
|
||||
bridge.focusService.Close()
|
||||
|
||||
Reference in New Issue
Block a user