From a3aafabde395398b5b560553f5794672ae4ac8cd Mon Sep 17 00:00:00 2001 From: Jakub Date: Fri, 10 Mar 2023 17:18:03 +0100 Subject: [PATCH] feat(GODT-2455): upper limit for number of merged events. --- go.mod | 2 +- go.sum | 4 ++-- internal/user/user.go | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index fc84cde9..9deb6745 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/Masterminds/semver/v3 v3.2.0 github.com/ProtonMail/gluon v0.15.1-0.20230310125443-f755e8ce082a github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a - github.com/ProtonMail/go-proton-api v0.4.1-0.20230228124441-781ee183e1b4 + github.com/ProtonMail/go-proton-api v0.4.1-0.20230313080847-655987fd5899 github.com/ProtonMail/go-rfc5322 v0.11.0 github.com/ProtonMail/gopenpgp/v2 v2.5.2 github.com/PuerkitoBio/goquery v1.8.1 diff --git a/go.sum b/go.sum index 03381247..526d9a29 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/ProtonMail/go-message v0.0.0-20210611055058-fabeff2ec753 h1:I8IsYA297 github.com/ProtonMail/go-message v0.0.0-20210611055058-fabeff2ec753/go.mod h1:NBAn21zgCJ/52WLDyed18YvYFm5tEoeDauubFqLokM4= github.com/ProtonMail/go-mime v0.0.0-20221031134845-8fd9bc37cf08 h1:dS7r5z4iGS0qCjM7UwWdsEMzQesUQbGcXdSm2/tWboA= github.com/ProtonMail/go-mime v0.0.0-20221031134845-8fd9bc37cf08/go.mod h1:qRZgbeASl2a9OwmsV85aWwRqic0NHPh+9ewGAzb4cgM= -github.com/ProtonMail/go-proton-api v0.4.1-0.20230228124441-781ee183e1b4 h1:isPTVpbcwhLB36fcpI9/YzLUi2rapuLsJiHP8GCB5EY= -github.com/ProtonMail/go-proton-api v0.4.1-0.20230228124441-781ee183e1b4/go.mod h1:4AXhqhB+AGVasVIlift9Lr1Btxg5S83xXPiyiT7mKUc= +github.com/ProtonMail/go-proton-api v0.4.1-0.20230313080847-655987fd5899 h1:E4MP+LfriJNfWBbD7Hr2913bEDFFzGei/D9Dh+MB+a0= +github.com/ProtonMail/go-proton-api v0.4.1-0.20230313080847-655987fd5899/go.mod h1:4AXhqhB+AGVasVIlift9Lr1Btxg5S83xXPiyiT7mKUc= github.com/ProtonMail/go-rfc5322 v0.11.0 h1:o5Obrm4DpmQEffvgsVqG6S4BKwC1Wat+hYwjIp2YcCY= github.com/ProtonMail/go-rfc5322 v0.11.0/go.mod h1:6oOKr0jXvpoE6pwTx/HukigQpX2J9WUf6h0auplrFTw= github.com/ProtonMail/go-srp v0.0.5 h1:xhUioxZgDbCnpo9JehyFhwwsn9JLWkUGfB0oiKXgiGg= diff --git a/internal/user/user.go b/internal/user/user.go index 1c163a66..564821f9 100644 --- a/internal/user/user.go +++ b/internal/user/user.go @@ -631,7 +631,7 @@ func (user *User) doEventPoll(ctx context.Context) error { user.eventLock.Lock() defer user.eventLock.Unlock() - event, err := user.client.GetEvent(ctx, user.vault.EventID()) + event, 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) } @@ -719,6 +719,10 @@ 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) + } + return nil }