You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scs.New() automatically invokes memstore.New(), which creates a goroutine to handle expired session cleanup. Because memstore is the default store, switching to a different store (like gormstore) leaves the memstore goroutine active and unreleased
// Initialize a new session manager and configure it to use gormstore as the session store.sessionManager=scs.New()
ifsessionManager.Store, err=gormstore.New(db); err!=nil {
log.Fatal(err)
}
Workaround solution:
ifmemStore, ok:=sessionManager.Store.(*memstore.MemStore); ok {
// HACK: Not sure why, but it seems a delay is needed before stopping the cleanup goroutine.time.Sleep(time.Second)
memStore.StopCleanup()
}
ifsessionManager.Store, err=gormstore.New(db); err!=nil {
log.Fatal(err)
}
The text was updated successfully, but these errors were encountered:
scs.New()
automatically invokesmemstore.New()
, which creates a goroutine to handle expired session cleanup. Becausememstore
is the default store, switching to a different store (like gormstore) leaves the memstore goroutine active and unreleasedscs/session.go
Line 106 in 7e11d57
Workaround solution:
The text was updated successfully, but these errors were encountered: