(userID string)
| 101 | } |
| 102 | |
| 103 | func (q *queues) deleteQueue(userID string) { |
| 104 | q.queuesMx.Lock() |
| 105 | defer q.queuesMx.Unlock() |
| 106 | |
| 107 | uq := q.userQueues[userID] |
| 108 | if uq == nil { |
| 109 | return |
| 110 | } |
| 111 | |
| 112 | delete(q.userQueues, userID) |
| 113 | q.users[uq.index] = "" |
| 114 | |
| 115 | // Shrink users list size if possible. This is safe, and no users will be skipped during iteration. |
| 116 | for ix := len(q.users) - 1; ix >= 0 && q.users[ix] == ""; ix-- { |
| 117 | q.users = q.users[:ix] |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | // Returns existing or new queue for user. |
| 122 | // MaxQueriers is used to compute which queriers should handle requests for this user. |
no outgoing calls