Code RoomSession touch lock released early
MediumPrep Room Coding #4530

Session touch lock released early

Code reviewConcurrencyMid–Senior~24 min

Review this Go session store. `Touch` refreshes a session's TTL under a write lock.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 24 min
Mark a line and say what kind of problem it is.0 findings
1func (s *Store) Touch(id string) error {
2 s.mu.RLock()
3 sess, ok := s.m[id]
4 if !ok {
5 return ErrNotFound // early return
6 }
7 s.mu.RUnlock()
8 
9 s.mu.Lock()
10 sess.expires = time.Now().Add(ttl)
11 s.mu.Unlock()
12 return nil
13}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.