MCPcopy Create free account
hub / github.com/daodst/chat / startTimer

Method startTimer

clientapi/routing/register.go:143–157  ·  view source on GitHub ↗
(duration time.Duration, sessionID string)

Source from the content-addressed store, hash-verified

141}
142
143func (d *sessionsDict) startTimer(duration time.Duration, sessionID string) {
144 d.Lock()
145 defer d.Unlock()
146 t, ok := d.timer[sessionID]
147 if ok {
148 if !t.Stop() {
149 <-t.C
150 }
151 t.Reset(duration)
152 return
153 }
154 d.timer[sessionID] = time.AfterFunc(duration, func() {
155 d.deleteSession(sessionID)
156 })
157}
158
159// addCompletedSessionStage records that a session has completed an auth stage
160// also starts a timer to delete the session once done.

Callers 4

addParamsMethod · 0.95
addDeviceToDeleteMethod · 0.95
TestSessionCleanUpFunction · 0.80

Calls 4

deleteSessionMethod · 0.95
LockMethod · 0.80
UnlockMethod · 0.80
StopMethod · 0.80

Tested by 1

TestSessionCleanUpFunction · 0.64