mirror of https://github.com/perkeep/perkeep.git
pkg/index: redo indexing of a blob when CAMLI_REDO_INDEX_ON_RECEIVE is set
So an upcoming HEIC reindexing tool. Updates #969 Change-Id: If194904d770bb670fa581c4e5e09c303806bc784
This commit is contained in:
parent
6af54cc882
commit
61de9881da
|
@ -222,6 +222,12 @@ files to be ignored by [pkg/client](/pkg/client) when uploading.
|
||||||
: If true, no thumbnail caching is done, and URLs even have cache
|
: If true, no thumbnail caching is done, and URLs even have cache
|
||||||
buster components, to force browsers to reload a lot.
|
buster components, to force browsers to reload a lot.
|
||||||
|
|
||||||
|
`CAMLI_REDO_INDEX_ON_RECEIVE` (bool)
|
||||||
|
: If true, the indexer will always index any blob it receives, regardless of
|
||||||
|
whether it thinks it's done it in the past. This is generally only useful when
|
||||||
|
working on the indexing code and retroactively indexing a subset of content
|
||||||
|
without forcing a global reindexing.
|
||||||
|
|
||||||
`CAMLI_VAR_DIR` (string)
|
`CAMLI_VAR_DIR` (string)
|
||||||
: Path used by [pkg/osutil](/pkg/osutil) to override operating system specific
|
: Path used by [pkg/osutil](/pkg/osutil) to override operating system specific
|
||||||
application storage directory. Generally unused.
|
application storage directory. Generally unused.
|
||||||
|
|
|
@ -220,9 +220,17 @@ func (ix *Index) ReceiveBlob(ctx context.Context, blobRef blob.Ref, source io.Re
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if haveVal, haveErr := ix.s.Get("have:" + blobRef.String()); haveErr == nil {
|
// By default, return immediately if it looks like we already
|
||||||
if strings.HasSuffix(haveVal, "|indexed") {
|
// have indexed this blob before. But if the user has
|
||||||
return sbr, nil
|
// CAMLI_REDO_INDEX_ON_RECEIVE set in their environment,
|
||||||
|
// always index it. This is generally only useful when working
|
||||||
|
// on the indexing code and retroactively indexing a subset of
|
||||||
|
// content without forcing a global reindexing.
|
||||||
|
if allowReindex, _ := strconv.ParseBool(os.Getenv("CAMLI_REDO_INDEX_ON_RECEIVE")); !allowReindex {
|
||||||
|
if haveVal, haveErr := ix.s.Get("have:" + blobRef.String()); haveErr == nil {
|
||||||
|
if strings.HasSuffix(haveVal, "|indexed") {
|
||||||
|
return sbr, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue