MCPcopy
hub / github.com/grpc/grpc-go / OnCallEnd

Method OnCallEnd

internal/idle/idle.go:260–273  ·  view source on GitHub ↗

OnCallEnd is invoked at the end of every RPC.

()

Source from the content-addressed store, hash-verified

258
259// OnCallEnd is invoked at the end of every RPC.
260func (m *Manager) OnCallEnd() {
261 if m.isClosed() {
262 return
263 }
264
265 // Record the time at which the most recent call finished.
266 atomic.StoreInt64(&m.lastCallEndTime, time.Now().UnixNano())
267
268 // Decrement the active calls count. This count can temporarily go negative
269 // when the timer callback is in the process of moving the channel to idle
270 // mode, but one or more RPCs come in and complete before the timer callback
271 // can get done with the process of moving to idle mode.
272 atomic.AddInt32(&m.activeCallsCount, -1)
273}
274
275func (m *Manager) isClosed() bool {
276 return atomic.LoadInt32(&m.closed) == 1

Calls 2

isClosedMethod · 0.95
NowMethod · 0.80