mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
3ca1e06509
This changes forks the mysql part of the Macaron session middleware. In the forked mysql file: - takes in a config setting for SetConnMaxLifetime (this solves wait_timeout problem if it is set to a shorter interval than wait_timeout) - removes the panic when an error is returned in the Exist function. - retries the exist query once - retries the GC query once
22 lines
468 B
Go
22 lines
468 B
Go
package middleware
|
|
|
|
import (
|
|
ms "github.com/go-macaron/session"
|
|
"gopkg.in/macaron.v1"
|
|
|
|
m "github.com/grafana/grafana/pkg/models"
|
|
"github.com/grafana/grafana/pkg/services/session"
|
|
)
|
|
|
|
func Sessioner(options *ms.Options, sessionConnMaxLifetime int64) macaron.Handler {
|
|
session.Init(options, sessionConnMaxLifetime)
|
|
|
|
return func(ctx *m.ReqContext) {
|
|
ctx.Next()
|
|
|
|
if err := ctx.Session.Release(); err != nil {
|
|
panic("session(release): " + err.Error())
|
|
}
|
|
}
|
|
}
|