修改集群模式使用封装的方法
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ func InitLeader(ctx context.Context, ref redis.UniversalClient, keyPrefix string
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
redis: ref,
|
||||
leaderUniLockKey: "timer:leader_lockKey" + keyPrefix,
|
||||
leaderUniLockKey: "timer:leader_lockKey" + op.source + keyPrefix,
|
||||
priority: op.priority,
|
||||
instanceId: op.instanceId,
|
||||
logger: op.logger,
|
||||
|
||||
@@ -10,6 +10,7 @@ type Options struct {
|
||||
logger logger.Logger
|
||||
instanceId string
|
||||
priority *priority.Priority // 全局优先级
|
||||
source string // 来源服务
|
||||
}
|
||||
|
||||
func defaultOptions() Options {
|
||||
@@ -49,3 +50,9 @@ func WithInstanceId(instanceId string) Option {
|
||||
o.instanceId = instanceId
|
||||
}
|
||||
}
|
||||
|
||||
func WithSource(source string) Option {
|
||||
return func(o *Options) {
|
||||
o.source = source
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user