Clean up *.tmp files
This MR introduces a gorutine that is executed every 5 minutes and deletes *.tmp
files if there is no in-progress indexing. In this MR I've also added an error if you try to index the same repository concurrently.
Closes #7 (closed)
Steps to reproduce the problem
- Add a big project in your GDK (you can import gitlab for example)
- Execute
make watch-run listen=:6061 index_dir=$GDK_DIR/zoekt-data/development/index
- Get project path by running
"#{project.repository.disk_path}.git"
- Add this line to
internal/zoekt/zoekt.go
to reduce the wait time
diff --git a/internal/zoekt/zoekt.go b/internal/zoekt/zoekt.go
index d124560..a6fb74e 100644
--- a/internal/zoekt/zoekt.go
+++ b/internal/zoekt/zoekt.go
@@ -50,6 +50,7 @@ func defaultBuilderOptions(opts *Options) *build.Options {
buildOpts := build.Options{
IndexDir: opts.IndexDir,
SizeMax: opts.SizeMax,
+ ShardMax: 1024,
RepositoryDescription: zoekt.Repository{
ID: opts.ID,
Name: fmt.Sprint(opts.ID),
- Execute
curl -XPOST -d '{"GitalyConnectionInfo": {"Address": "unix:/$GDK_DIR/praefect.socket", "Storage": "default", "Path": "<@hashed/....git>"}, "RepoId":23, "FileSizeLimit": 2097152, "Timeout": "5s"}' -H 'Content-Type: application/json' http://127.0.0.1:6061/indexer/index
- Ensure that the request has timed out and that you have multiple
*.tmp
files in$GDK_DIR/zoekt-data/development/index
- Wait until the tmp files automatically removed (you can change
TmpCleanupTicker
if you don't want to waint 5 minutes)
Edited by Dmitry Gruzd