fix lack of middleware in /go handler, also add tracing to session sweeper

This commit is contained in:
2026-04-06 13:41:09 -06:00
parent 3c87b973e1
commit 44a2e6dedc
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ func setupEcho() *echo.Echo {
e.GET("/venice/imagedata/:id", ui.AmServeVeniceCompatibleImage)
}
e.GET("/static/*", ui.AmStaticFileHandler())
e.GET("/go/:postlink", ui.AmWrap(JumpToShortcut))
e.GET("/go/:postlink", ui.AmWrap(JumpToShortcut), uiset...)
e.GET("/", ui.AmWrap(TopPage), uiset...)
e.GET("/about", ui.AmWrap(AboutPage), uiset...)
+3 -1
View File
@@ -242,7 +242,7 @@ func (sess *amSession) Hit() {
sess.Set("lasthit", time.Now())
}
// amSessionStore is the implementatiuon structure for AmSessionStore.
// amSessionStore is the implementation structure for AmSessionStore.
type amSessionStore struct {
mutex sync.RWMutex
sessions map[string]*amSession
@@ -342,6 +342,7 @@ func (st *amSessionStore) SessionInfo() (int, []string, int) {
func (st *amSessionStore) sweep(tick <-chan time.Time, done chan bool) {
for range tick {
if st.sweepRunning.Load() {
log.Infof("session sweep running")
// phase 1 - identify expired sessions
st.mutex.RLock()
zap := make([]string, 0, len(st.sessions))
@@ -352,6 +353,7 @@ func (st *amSessionStore) sweep(tick <-chan time.Time, done chan bool) {
}
}
st.mutex.RUnlock()
log.Infof("identified %d sessions to zap", len(zap))
// phase 2 - get rid of the expired sessions
for _, k := range zap {