fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

indexserver: always cleanup if index fails (#348)

Not cleaning up is old code (2 years!) from when we transitioned to
using shallow git clones. We don't ever inspect these failed clones, so
lets just clean up. This now explains why I often see such big
.indexserver.tmp directories.

Test Plan: go test

+1 -8
+1 -8
cmd/zoekt-sourcegraph-indexserver/index.go
··· 172 172 if err != nil { 173 173 return err 174 174 } 175 - // We intentionally leave behind gitdir if indexing failed so we can 176 - // investigate. This is only during the experimental phase of indexing a 177 - // clone. So don't defer os.RemoveAll here 175 + defer os.RemoveAll(gitDir) // best-effort cleanup 178 176 179 177 // Create a repo to fetch into 180 178 cmd := exec.CommandContext(ctx, "git", ··· 339 337 cmd.Stdin = &bytes.Buffer{} 340 338 if err := runCmd(cmd); err != nil { 341 339 return err 342 - } 343 - 344 - // Do not return error, since we have successfully indexed. Just log it 345 - if err := os.RemoveAll(gitDir); err != nil { 346 - log.Printf("WARN: failed to cleanup %s after successfully indexing %s: %v", gitDir, o.String(), err) 347 340 } 348 341 349 342 return nil