Merge "importer/gphotos: more little cleanups"

This commit is contained in:
Brad Fitzpatrick 2017-12-17 20:06:24 +00:00 committed by Gerrit Code Review
commit ac517f7b75
1 changed files with 6 additions and 3 deletions

View File

@ -267,7 +267,6 @@ and create a new project.</p>
// A run is our state for a given run of the importer. // A run is our state for a given run of the importer.
type run struct { type run struct {
*importer.RunContext *importer.RunContext
incremental bool // whether we've completed a run in the past
photoGate *syncutil.Gate photoGate *syncutil.Gate
setNextToken func(string) error setNextToken func(string) error
dl *downloader dl *downloader
@ -310,7 +309,6 @@ func (imp) Run(rctx *importer.RunContext) error {
} }
r := &run{ r := &run{
RunContext: rctx, RunContext: rctx,
incremental: !forceFullImport && acctNode.Attr(importer.AcctAttrCompletedVersion) == runCompleteVersion,
photoGate: syncutil.NewGate(3), photoGate: syncutil.NewGate(3),
setNextToken: func(nextToken string) error { return acctNode.SetAttr(acctSinceToken, nextToken) }, setNextToken: func(nextToken string) error { return acctNode.SetAttr(acctSinceToken, nextToken) },
dl: dl, dl: dl,
@ -419,10 +417,15 @@ func (ph photo) title(altTitle string) string {
// contents, and with no conflicting attributes, exists. So we reuse that // contents, and with no conflicting attributes, exists. So we reuse that
// permanode. // permanode.
// 4) A permanode for the photo object already exists, so we reuse it. // 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 == "" { if ph.ID == "" {
return errors.New("photo has no 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 // fileRefStr, in addition to being used as the camliConent value, is used
// as a sentinel: if it is still blank after the call to // as a sentinel: if it is still blank after the call to