From 3ef0c73826888305dcf2a40171717946efc6b070 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 20 Oct 2019 16:05:53 +0100 Subject: [PATCH] drive: fix ChangeNotify polling for shared drives Before this fix we neglected to add the shared drive ID to the request when asking for an initial change notify token and this caused a lot more results to be returned than was necessary. --- backend/drive/drive.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/drive/drive.go b/backend/drive/drive.go index 00f17e2fc..ebc88aa9d 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -2314,9 +2314,11 @@ func (f *Fs) ChangeNotify(ctx context.Context, notifyFunc func(string, fs.EntryT func (f *Fs) changeNotifyStartPageToken() (pageToken string, err error) { var startPageToken *drive.StartPageToken err = f.pacer.Call(func() (bool, error) { - startPageToken, err = f.svc.Changes.GetStartPageToken(). - SupportsAllDrives(true). - Do() + changes := f.svc.Changes.GetStartPageToken().SupportsAllDrives(true) + if f.isTeamDrive { + changes.DriveId(f.opt.TeamDriveID) + } + startPageToken, err = changes.Do() return shouldRetry(err) }) if err != nil { @@ -2339,7 +2341,7 @@ func (f *Fs) changeNotifyRunner(ctx context.Context, notifyFunc func(string, fs. changesCall.SupportsAllDrives(true) changesCall.IncludeItemsFromAllDrives(true) if f.isTeamDrive { - changesCall.TeamDriveId(f.opt.TeamDriveID) + changesCall.DriveId(f.opt.TeamDriveID) } changeList, err = changesCall.Context(ctx).Do() return shouldRetry(err)