处理Leader的key为空问题
This commit is contained in:
+3
-3
@@ -9,8 +9,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
"github.com/yuninks/cachex"
|
"github.com/yuninks/cachex"
|
||||||
"github.com/yuninks/lockx"
|
"github.com/yuninks/lockx"
|
||||||
"github.com/yuninks/timerx/heartbeat"
|
"github.com/yuninks/timerx/heartbeat"
|
||||||
@@ -94,7 +94,7 @@ func InitCluster(ctx context.Context, red redis.UniversalClient, keyPrefix strin
|
|||||||
pri, err := priority.InitPriority(
|
pri, err := priority.InitPriority(
|
||||||
ctx,
|
ctx,
|
||||||
red,
|
red,
|
||||||
clu.priorityKey,
|
clu.keyPrefix,
|
||||||
op.priorityVal,
|
op.priorityVal,
|
||||||
priority.WithLogger(clu.logger),
|
priority.WithLogger(clu.logger),
|
||||||
priority.WithInstanceId(clu.instanceId),
|
priority.WithInstanceId(clu.instanceId),
|
||||||
@@ -111,7 +111,7 @@ func InitCluster(ctx context.Context, red redis.UniversalClient, keyPrefix strin
|
|||||||
le, err := leader.InitLeader(
|
le, err := leader.InitLeader(
|
||||||
ctx,
|
ctx,
|
||||||
clu.redis,
|
clu.redis,
|
||||||
keyPrefix,
|
clu.keyPrefix,
|
||||||
leader.WithLogger(clu.logger),
|
leader.WithLogger(clu.logger),
|
||||||
leader.WithPriority(clu.priority),
|
leader.WithPriority(clu.priority),
|
||||||
leader.WithInstanceId(clu.instanceId),
|
leader.WithInstanceId(clu.instanceId),
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ func InitLeader(ctx context.Context, ref redis.UniversalClient, keyPrefix string
|
|||||||
cancel: cancel,
|
cancel: cancel,
|
||||||
redis: ref,
|
redis: ref,
|
||||||
leaderUniLockKey: "timer:leader_lockKey" + op.source + keyPrefix,
|
leaderUniLockKey: "timer:leader_lockKey" + op.source + keyPrefix,
|
||||||
|
leaderKey: "timer:leader" + op.source + keyPrefix,
|
||||||
priority: op.priority,
|
priority: op.priority,
|
||||||
instanceId: op.instanceId,
|
instanceId: op.instanceId,
|
||||||
logger: op.logger,
|
logger: op.logger,
|
||||||
|
|||||||
Reference in New Issue
Block a user