importer/gphotos: more little cleanups

Change-Id: Ia97d56eb3e3f302f60c30af08a220cfa011936e2
This commit is contained in:
Brad Fitzpatrick 2017-12-17 08:29:50 -08:00
parent fcd5ff14e9
commit 77a37d01b3
1 changed files with 6 additions and 3 deletions

View File

@ -266,7 +266,6 @@ and create a new project.</p>
// 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