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

Configure Feed

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

Remove Queue.init (#808)

`Queue` is always created through `NewQueue`, which always initializes the data
structures. So we don't need to initialize them in other methods.

+5 -18
+5 -18
cmd/zoekt-sourcegraph-indexserver/queue.go
··· 73 73 } 74 74 } 75 75 76 - q := &Queue{ 77 - newQueueItem: newQueueItem, 76 + return &Queue{ 77 + items: map[uint32]*queueItem{}, 78 + pq: make(pqueue, 0), 79 + seq: 0, 78 80 logger: l.Scoped("queue"), 81 + newQueueItem: newQueueItem, 79 82 } 80 - 81 - q.init() 82 - return q 83 83 } 84 84 85 85 type QueueItem struct { ··· 153 153 func (q *Queue) Bump(ids []uint32) []uint32 { 154 154 q.mu.Lock() 155 155 defer q.mu.Unlock() 156 - 157 - if q.items == nil { 158 - q.init() 159 - } 160 156 161 157 var missing []uint32 162 158 for _, id := range ids { ··· 364 360 // 365 361 // Note: getOrAdd requires that q.mu is held. 366 362 func (q *Queue) getOrAdd(repoID uint32) *queueItem { 367 - if q.items == nil { 368 - q.init() 369 - } 370 - 371 363 item, ok := q.items[repoID] 372 364 if !ok { 373 365 item = q.newQueueItem(repoID) ··· 382 374 // Note: get requires that q.mu is held. 383 375 func (q *Queue) get(repoID uint32) *queueItem { 384 376 return q.items[repoID] 385 - } 386 - 387 - func (q *Queue) init() { 388 - q.items = map[uint32]*queueItem{} 389 - q.pq = make(pqueue, 0) 390 377 } 391 378 392 379 // pqueue implements a priority queue via the interface for container/heap