fix(session): resolve race conditions #151

Merged
bagas merged 4 commits from fix/session-race-conditions into staging 2026-07-17 22:22:25 +07:00
Showing only changes of commit 1c591882cc - Show all commits
+7
View File
@@ -1,11 +1,14 @@
package slug
import "sync"
type Slug interface {
String() string
Set(slug string)
}
type slug struct {
mu sync.RWMutex
slug string
}
@@ -16,9 +19,13 @@ func New() Slug {
}
func (s *slug) String() string {
s.mu.RLock()
defer s.mu.RUnlock()
return s.slug
}
func (s *slug) Set(slug string) {
s.mu.Lock()
defer s.mu.Unlock()
s.slug = slug
}