From 77a37d01b3b677373e7862a2cd74ab84d9d7a57c Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 17 Dec 2017 08:29:50 -0800 Subject: [PATCH] importer/gphotos: more little cleanups Change-Id: Ia97d56eb3e3f302f60c30af08a220cfa011936e2 --- pkg/importer/gphotos/gphotos.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/importer/gphotos/gphotos.go b/pkg/importer/gphotos/gphotos.go index c0387be32..f9a7f77dc 100644 --- a/pkg/importer/gphotos/gphotos.go +++ b/pkg/importer/gphotos/gphotos.go @@ -266,7 +266,6 @@ and create a new project.

// A run is our state for a given run of the importer. type run struct { *importer.RunContext - incremental bool // whether we've completed a run in the past photoGate *syncutil.Gate setNextToken func(string) error dl *downloader @@ -309,7 +308,6 @@ func (imp) Run(rctx *importer.RunContext) error { } r := &run{ RunContext: rctx, - incremental: !forceFullImport && acctNode.Attr(importer.AcctAttrCompletedVersion) == runCompleteVersion, photoGate: syncutil.NewGate(3), setNextToken: func(nextToken string) error { return acctNode.SetAttr(acctSinceToken, nextToken) }, dl: dl, @@ -418,10 +416,15 @@ func (ph photo) title(altTitle string) string { // contents, and with no conflicting attributes, exists. So we reuse that // permanode. // 4) A permanode for the photo object already exists, so we reuse it. -func (r *run) updatePhoto(ctx context.Context, parent *importer.Object, ph photo) (ret error) { +func (r *run) updatePhoto(ctx context.Context, parent *importer.Object, ph photo) error { if ph.ID == "" { return errors.New("photo has no ID") } + select { + case <-ctx.Done(): + return ctx.Err() + default: + } // fileRefStr, in addition to being used as the camliConent value, is used // as a sentinel: if it is still blank after the call to