mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
change from db_text to nvarchar
This commit is contained in:
@@ -8,7 +8,7 @@ func (sl *ServerLockService) AddMigration(mg *migrator.Migrator) {
|
|||||||
Name: "server_lock",
|
Name: "server_lock",
|
||||||
Columns: []*migrator.Column{
|
Columns: []*migrator.Column{
|
||||||
{Name: "id", Type: migrator.DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
{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: "version", Type: migrator.DB_BigInt},
|
||||||
{Name: "last_execution", Type: migrator.DB_BigInt, Nullable: false},
|
{Name: "last_execution", Type: migrator.DB_BigInt, Nullable: false},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ type ServerLockService struct {
|
|||||||
|
|
||||||
// Init this service
|
// Init this service
|
||||||
func (sl *ServerLockService) Init() error {
|
func (sl *ServerLockService) Init() error {
|
||||||
|
sl.log = log.New("infra.lockservice")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/grafana/grafana/pkg/infra/serverlock"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/bus"
|
"github.com/grafana/grafana/pkg/bus"
|
||||||
"github.com/grafana/grafana/pkg/log"
|
"github.com/grafana/grafana/pkg/log"
|
||||||
m "github.com/grafana/grafana/pkg/models"
|
m "github.com/grafana/grafana/pkg/models"
|
||||||
@@ -15,8 +17,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type CleanUpService struct {
|
type CleanUpService struct {
|
||||||
log log.Logger
|
log log.Logger
|
||||||
Cfg *setting.Cfg `inject:""`
|
Cfg *setting.Cfg `inject:""`
|
||||||
|
ServerLockService *serverlock.ServerLockService `inject:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -38,7 +41,10 @@ func (srv *CleanUpService) Run(ctx context.Context) error {
|
|||||||
srv.cleanUpTmpFiles()
|
srv.cleanUpTmpFiles()
|
||||||
srv.deleteExpiredSnapshots()
|
srv.deleteExpiredSnapshots()
|
||||||
srv.deleteExpiredDashboardVersions()
|
srv.deleteExpiredDashboardVersions()
|
||||||
srv.deleteOldLoginAttempts()
|
srv.ServerLockService.OncePerServerGroup(ctx, "delete old login attempts", time.Minute*10, func() {
|
||||||
|
srv.deleteOldLoginAttempts()
|
||||||
|
})
|
||||||
|
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user