Update and replace sid. Lock should be held on entry but will be unlocked to prevent lock inversion.
()
| 2176 | // Update and replace sid. |
| 2177 | // Lock should be held on entry but will be unlocked to prevent lock inversion. |
| 2178 | func (sub *Subscription) applyNewSID() (osid int64) { |
| 2179 | nc := sub.conn |
| 2180 | sub.mu.Unlock() |
| 2181 | |
| 2182 | nc.subsMu.Lock() |
| 2183 | osid = sub.sid |
| 2184 | delete(nc.subs, osid) |
| 2185 | // Place new one. |
| 2186 | nc.ssid++ |
| 2187 | nsid := nc.ssid |
| 2188 | nc.subs[nsid] = sub |
| 2189 | nc.subsMu.Unlock() |
| 2190 | |
| 2191 | sub.mu.Lock() |
| 2192 | sub.sid = nsid |
| 2193 | return osid |
| 2194 | } |
| 2195 | |
| 2196 | // We are here if we have detected a gap with an ordered consumer. |
| 2197 | // We will create a new consumer and rewire the low level subscription. |
no outgoing calls
no test coverage detected