mirror of https://github.com/perkeep/perkeep.git
Merge "importer/gphotos: more little cleanups"
This commit is contained in:
commit
ac517f7b75
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue