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

Configure Feed

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

indexserver: PAUSE file to stop indexserver (#140)

PAUSE if present in IndexDir will stop index jobs from running. This is
to make it possible to experiment with the content of the IndexDir
without the indexserver writing to it.

+16
+1
.gitignore
··· 6 6 cmd/zoekt-git-index/zoekt-git-index 7 7 .envrc 8 8 .idea 9 + .direnv
+15
cmd/zoekt-sourcegraph-indexserver/main.go
··· 239 239 return repoName 240 240 } 241 241 242 + // pauseFileName if present in IndexDir will stop index jobs from 243 + // running. This is to make it possible to experiment with the content of the 244 + // IndexDir without the indexserver writing to it. 245 + const pauseFileName = "PAUSE" 246 + 242 247 // Run the sync loop. This blocks forever. 243 248 func (s *Server) Run(queue *Queue) { 244 249 removeIncompleteShards(s.IndexDir) ··· 246 251 // Start a goroutine which updates the queue with commits to index. 247 252 go func() { 248 253 for range jitterTicker(s.Interval) { 254 + if b, err := os.ReadFile(filepath.Join(s.IndexDir, pauseFileName)); err == nil { 255 + log.Printf("indexserver manually paused via PAUSE file: %s", string(bytes.TrimSpace(b))) 256 + continue 257 + } 258 + 249 259 repos, err := s.Sourcegraph.ListRepos(context.Background(), listIndexed(s.IndexDir)) 250 260 if err != nil { 251 261 log.Println(err) ··· 306 316 307 317 // In the current goroutine process the queue forever. 308 318 for { 319 + if _, err := os.Stat(filepath.Join(s.IndexDir, pauseFileName)); err == nil { 320 + time.Sleep(time.Second) 321 + continue 322 + } 323 + 309 324 name, opts, ok := queue.Pop() 310 325 if !ok { 311 326 time.Sleep(time.Second)