fix(GODT-2442): WIP: bad events just aborts polls, feedback processed in separete channel.

This commit is contained in:
Jakub
2023-03-07 13:48:34 +01:00
parent 34c002ff68
commit 2c9477d65c
4 changed files with 66 additions and 61 deletions

View File

@ -86,16 +86,16 @@ func (user *User) handleRefreshEvent(ctx context.Context, refresh proton.Refresh
l.WithError(err).Error("Failed to report refresh to sentry")
}
return user.SyncEvent(ctx)
}
func (user *User) SyncEvent(ctx context.Context) error {
// Abort the event stream
defer user.pollAbort.Abort()
// Re-sync messages after the user, address and label refresh.
defer user.goSync()
return user.syncUserAddressesAndLabels(ctx)
}
func (user *User) syncUserAddressesAndLabels(ctx context.Context) error {
return safe.LockRet(func() error {
// Fetch latest user info.
apiUser, err := user.client.GetUser(ctx)