MCPcopy
hub / github.com/nats-io/nats.go / applyNewSID

Method applyNewSID

js.go:2178–2194  ·  view source on GitHub ↗

Update and replace sid. Lock should be held on entry but will be unlocked to prevent lock inversion.

()

Source from the content-addressed store, hash-verified

2176// Update and replace sid.
2177// Lock should be held on entry but will be unlocked to prevent lock inversion.
2178func (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.

Callers 1

resetOrderedConsumerMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected