fix(GODT-2626): Server Events should not be merged.

d18e5932b28f83b201709a04fb7b8c6f74003574
Includes GPA bump: https://github.com/ProtonMail/go-proton-api/pull/80
This commit is contained in:
Leander Beernaert
2023-05-16 09:53:41 +02:00
parent 8c958cdc2f
commit 4e3ad4f7fa
3 changed files with 65 additions and 61 deletions

2
go.mod
View File

@ -7,7 +7,7 @@ require (
github.com/Masterminds/semver/v3 v3.2.0
github.com/ProtonMail/gluon v0.16.1-0.20230516073349-d18e5932b28f
github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a
github.com/ProtonMail/go-proton-api v0.4.1-0.20230505091503-167f3d239b0c
github.com/ProtonMail/go-proton-api v0.4.1-0.20230516070548-faf4f87bf9e7
github.com/ProtonMail/gopenpgp/v2 v2.7.1-proton
github.com/PuerkitoBio/goquery v1.8.1
github.com/abiosoft/ishell v2.0.0+incompatible

2
go.sum
View File

@ -41,6 +41,8 @@ github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f h1:tCbYj7/299ek
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f/go.mod h1:gcr0kNtGBqin9zDW9GOHcVntrwnjrK+qdJ06mWYBybw=
github.com/ProtonMail/go-proton-api v0.4.1-0.20230505091503-167f3d239b0c h1:uqo3mKt4ffhqPFLVV7VxjuN12DAFQmqEju/Wy5dk6Rk=
github.com/ProtonMail/go-proton-api v0.4.1-0.20230505091503-167f3d239b0c/go.mod h1:UkrG9gN2o9mzdx/an0XRc6a4s5Haef1A7Eyd2iXlw28=
github.com/ProtonMail/go-proton-api v0.4.1-0.20230516070548-faf4f87bf9e7 h1:7aY4azqc8PzYtg4+xG7b9wBEnckrl7rVMlMoFMWRkdA=
github.com/ProtonMail/go-proton-api v0.4.1-0.20230516070548-faf4f87bf9e7/go.mod h1:UkrG9gN2o9mzdx/an0XRc6a4s5Haef1A7Eyd2iXlw28=
github.com/ProtonMail/go-srp v0.0.5 h1:xhUioxZgDbCnpo9JehyFhwwsn9JLWkUGfB0oiKXgiGg=
github.com/ProtonMail/go-srp v0.0.5/go.mod h1:06iYHtLXW8vjLtccWj++x3MKy65sIT8yZd7nrJF49rs=
github.com/ProtonMail/gopenpgp/v2 v2.7.1-proton h1:YS6M20yvjCJPR1r4ADW5TPn6rahs4iAyZaACei86bEc=

View File

@ -690,17 +690,18 @@ func (user *User) doEventPoll(ctx context.Context) error {
user.eventLock.Lock()
defer user.eventLock.Unlock()
event, more, err := user.client.GetEvent(ctx, user.vault.EventID())
gpaEvents, more, err := user.client.GetEvent(ctx, user.vault.EventID())
if err != nil {
return fmt.Errorf("failed to get event (caused by %T): %w", internal.ErrCause(err), err)
}
// If the event ID hasn't changed, there are no new events.
if event.EventID == user.vault.EventID() {
if gpaEvents[len(gpaEvents)-1].EventID == user.vault.EventID() {
user.log.Debug("No new API events")
return nil
}
for _, event := range gpaEvents {
user.log.WithFields(logrus.Fields{
"old": user.vault.EventID(),
"new": event,
@ -770,6 +771,7 @@ func (user *User) doEventPoll(ctx context.Context) error {
}
user.log.WithField("eventID", event.EventID).Debug("Updated event ID in vault")
}
if more {
user.goPollAPIEvents(false)