Commit 823bba8d by bergquist

change from db_text to nvarchar

parent dc49bebb
......@@ -8,7 +8,7 @@ func (sl *ServerLockService) AddMigration(mg *migrator.Migrator) {
Name: "server_lock",
Columns: []*migrator.Column{
{Name: "id", Type: migrator.DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
{Name: "operation_uid", Type: migrator.DB_Text},
{Name: "operation_uid", Type: migrator.DB_NVarchar, Length: 100},
{Name: "version", Type: migrator.DB_BigInt},
{Name: "last_execution", Type: migrator.DB_BigInt, Nullable: false},
},
......
......@@ -21,6 +21,7 @@ type ServerLockService struct {
// Init this service
func (sl *ServerLockService) Init() error {
sl.log = log.New("infra.lockservice")
return nil
}
......
......@@ -7,6 +7,8 @@ import (
"path"
"time"
"github.com/grafana/grafana/pkg/infra/serverlock"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/log"
m "github.com/grafana/grafana/pkg/models"
......@@ -17,6 +19,7 @@ import (
type CleanUpService struct {
log log.Logger
Cfg *setting.Cfg `inject:""`
ServerLockService *serverlock.ServerLockService `inject:""`
}
func init() {
......@@ -38,7 +41,10 @@ func (srv *CleanUpService) Run(ctx context.Context) error {
srv.cleanUpTmpFiles()
srv.deleteExpiredSnapshots()
srv.deleteExpiredDashboardVersions()
srv.ServerLockService.OncePerServerGroup(ctx, "delete old login attempts", time.Minute*10, func() {
srv.deleteOldLoginAttempts()
})
case <-ctx.Done():
return ctx.Err()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment