Repository navigation
feat(search): add a --timeout flag to the index command - #13053
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
@paul43210 all your PRs fail because of proper semantic commits, please fix.
|
6510d1a to
31a05c5
Compare
ocis search index called the search service with a hard-coded 10 minute request timeout. The service walks the whole space inside that request, so when the timeout expired the walk was cancelled (error walking the tree: context canceled) and everything after that point stayed unindexed. A space whose walk takes longer than ten minutes could never be fully indexed from the command line. The timeout is now a flag: --timeout takes a duration, default 10m so the behaviour is unchanged out of the box; 0 waits indefinitely (go-micro treats a zero RequestTimeout as an already-expired deadline, so a far-off one is substituted). Fixes owncloud#13052 Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Paul Faure <paul@faure.ca>
31a05c5 to
8cf9a72
Compare
|
I'm not against this, but I'm missing a warning somewhere: the search engine uses an exclusive lock by default. This means that, by default, if oCIS (the search service in particular) is started, this command won't work. If this command runs before oCIS starts, the search service won't search until the command finishes. Check the "scaling" section of the README file. Since the |
The index command is a gRPC client of the search service and never opens the Bleve index, so it works with the default exclusive lock (SEARCH_ENGINE_BLEVE_SCALE=false) but needs the service running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpoeSoKYEdgQcWjEzTVKpT Signed-off-by: Paul Faure <paul@faure.ca>
|
@jvillafanez thanks. I don't think the lock applies to this command, though. The flip side is worth saying, so I added a sentence to the README in cfd12b0: the search service must be running, and the default exclusive lock doesn't block the command. |
Description
ocis search index --space <id>/--all-spacescallsIndexSpacewith a hard-coded go-microRequestTimeoutof 10 minutes. The service walks the whole space inside that request's context, so once the timeout expires the next gateway call inside the walk fails withrpc error: code = Canceled(orDeadlineExceeded), the walk logserror walking the treeand stops, and the CLI printsfailed to index space: … context deadline exceeded. Everything after the cancellation point stays unindexed, and a space whose walk takes longer than ten minutes can never be fully indexed from the command line.This PR makes the timeout a flag:
--timeout <duration>, default10m, so the behaviour is unchanged for anyone not passing it;0waits indefinitely. go-micro's gRPC client appliescontext.WithTimeout(ctx, RequestTimeout)unconditionally when the context has no deadline, so a zero value would expire at once; the command substitutes a far-off duration instead (commented in the code);No service, config or interface changes.
Related Issue
ocis search indexcancels any space walk longer than 10 minutes #13052Motivation and Context
On an oCIS 8.2.0 single-binary instance with a Tika extractor, a 30,000-file personal space has three scanned PDFs the extractor cannot finish; each costs the walk several minutes, so a full walk takes 15–20 minutes. Every
ocis search indexrun was cancelled at exactly 10 minutes (observed 2026-09-30 and 2026-10-01:error walking the tree: rpc error: code = Canceled desc = context canceled), while an event-triggered walk of the same space, which runs withcontext.Background(), completed. A nightly--all-spacessafety net is impossible without a way to allow a longer run.How Has This Been Tested?
go.mod), Linux amd64, branch based on currentmaster(784c5ec).go build ./services/search/...andgo vet ./services/search/pkg/command/clean;make changelog-lintclean.urfave/cli'sDurationFlag. The 10-minute cancellation itself is reproducible on the instance described above with the unmodified 8.2.0 binary.Screenshots (if appropriate):
n/a
Types of changes
Checklist:
🤖 Generated with Claude Code
https://claude.ai/code/session_01WpoeSoKYEdgQcWjEzTVKpT