OnCallEnd is invoked at the end of every RPC.
()
| 258 | |
| 259 | // OnCallEnd is invoked at the end of every RPC. |
| 260 | func (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 | |
| 275 | func (m *Manager) isClosed() bool { |
| 276 | return atomic.LoadInt32(&m.closed) == 1 |