diff --git a/pkg/services/accesscontrol/dualwrite/reconciler.go b/pkg/services/accesscontrol/dualwrite/reconciler.go index 2f1fe07ec2d..996d3032c07 100644 --- a/pkg/services/accesscontrol/dualwrite/reconciler.go +++ b/pkg/services/accesscontrol/dualwrite/reconciler.go @@ -98,9 +98,8 @@ func (r *ZanzanaReconciler) Reconcile(ctx context.Context) error { r.reconcile(ctx) // FIXME: - // 1. We should be a bit graceful about reconciliations so we are not hammering dbs - // 2. We should be able to configure reconciliation interval - ticker := time.NewTicker(1 * time.Hour) + // We should be a bit graceful about reconciliations so we are not hammering dbs + ticker := time.NewTicker(r.cfg.RBAC.ZanzanaReconciliationInterval) for { select { case <-ticker.C: diff --git a/pkg/setting/settings_rbac.go b/pkg/setting/settings_rbac.go index 393f9db3409..5bfd91fedcc 100644 --- a/pkg/setting/settings_rbac.go +++ b/pkg/setting/settings_rbac.go @@ -1,6 +1,9 @@ package setting import ( + "time" + + "github.com/grafana/grafana-plugin-sdk-go/backend/gtime" "github.com/grafana/grafana/pkg/util" ) @@ -13,6 +16,9 @@ type RBACSettings struct { ResetBasicRoles bool // RBAC single organization. This configuration option is subject to change. SingleOrganization bool + // If zanzana feature toggle is enabled this controls how often we + // run the zanzana reconciliation loop. + ZanzanaReconciliationInterval time.Duration OnlyStoreAccessActionSets bool @@ -47,6 +53,12 @@ func (cfg *Cfg) readRBACSettings() { s.resourcesWithWildcardSeed[resource] = struct{}{} } + var err error + s.ZanzanaReconciliationInterval, err = gtime.ParseDuration(rbac.Key("zanzana_reconciliation_interval").MustString("1h")) + if err != nil { + s.ZanzanaReconciliationInterval = 1 * time.Hour + } + cfg.RBAC = s }