From f676667d7c0bf832c5278d4314bf788902eede6f Mon Sep 17 00:00:00 2001 From: Mulavar <978007503@qq.com> Date: Sun, 13 Nov 2022 20:14:29 +0800 Subject: [PATCH] fix(admin): add writer flag to help admin init (#507) Co-authored-by: Jianhui Dong --- pkg/boot/discovery.go | 1 + pkg/sequence/group/group.go | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/boot/discovery.go b/pkg/boot/discovery.go index fd924b1c..a9ffb16f 100644 --- a/pkg/boot/discovery.go +++ b/pkg/boot/discovery.go @@ -445,6 +445,7 @@ func (fp *discovery) InitTenant(tenant string) error { config.WithCacheable(true), config.WithReader(true), config.WithWatcher(true), + config.WithWriter(true), ) return err } diff --git a/pkg/sequence/group/group.go b/pkg/sequence/group/group.go index e7420348..5cc8b6e5 100644 --- a/pkg/sequence/group/group.go +++ b/pkg/sequence/group/group.go @@ -44,9 +44,9 @@ func init() { const ( SequencePluginName = "group" - _stepKey = "step" - _startSequence int64 = 1 - _defaultGroupStrep int64 = 100 + _stepKey = "step" + _startSequence int64 = 1 + _defaultGroupStep int64 = 100 _initGroupSequenceTableSql = ` CREATE TABLE IF NOT EXISTS __arana_group_sequence ( @@ -94,7 +94,7 @@ func (seq *groupSequence) Start(ctx context.Context, option proto.SequenceConfig } // init sequence - if err := seq.initStep(ctx, rt, option); err != nil { + if err := seq.initStep(option); err != nil { return err } @@ -131,7 +131,7 @@ func (seq *groupSequence) initTable(ctx context.Context, rt runtime.Runtime) err return nil } -func (seq *groupSequence) initStep(ctx context.Context, rt runtime.Runtime, option proto.SequenceConfig) error { +func (seq *groupSequence) initStep(option proto.SequenceConfig) error { seq.mu.Lock() defer seq.mu.Unlock() @@ -144,7 +144,7 @@ func (seq *groupSequence) initStep(ctx context.Context, rt runtime.Runtime, opti } step = int64(tempStep) } else { - step = _defaultGroupStrep + step = _defaultGroupStep } seq.step = step