From c4056bd63efe366a2092990c183a6776e1119c2d Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Thu, 27 Mar 2025 08:57:24 -0400 Subject: [PATCH] providers/session: Use usync.Monitor instead of usync.Locker --- providers/session/session.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/providers/session/session.go b/providers/session/session.go index c6ec30f..00bc212 100644 --- a/providers/session/session.go +++ b/providers/session/session.go @@ -24,7 +24,7 @@ type Provider struct { Lifetime time.Duration InsecureCookie bool CookieDomain string - sessions usync.RWLocker[sessionMap] + sessions usync.RWMonitor[sessionMap] } // Package fulfills the step.Provider interface. @@ -33,7 +33,7 @@ func (this *Provider) Package () string { } func (this *Provider) Init () error { - this.sessions = usync.NewRWLocker(make(sessionMap)) + this.sessions = usync.NewRWMonitor(make(sessionMap)) return nil } @@ -88,7 +88,7 @@ func (this *Provider) FuncMapFor (document *step.Document) template.FuncMap { type state struct { document *step.Document - sessions *usync.RWLocker[sessionMap] + sessions *usync.RWMonitor[sessionMap] lifetime time.Duration insecureCookie bool cookieDomain string @@ -167,8 +167,8 @@ func (this *state) newSession (id uuid.UUID, expires time.Time) (*Session, error return &Session { parent: this, id: id, - data: usync.NewRWLocker(make(map[string] any)), - expires: usync.NewRWLocker(expires), + data: usync.NewRWMonitor(make(map[string] any)), + expires: usync.NewRWMonitor(expires), }, nil } @@ -177,8 +177,8 @@ type sessionMap map[uuid.UUID] *Session type Session struct { parent *state // immutable id uuid.UUID // immutable - data usync.RWLocker[map[string] any] // mutable - expires usync.RWLocker[time.Time] // mutable + data usync.RWMonitor[map[string] any] // mutable + expires usync.RWMonitor[time.Time] // mutable } func (this *Session) ID () uuid.UUID {