sofastack / sofa-jraft

A production-grade java implementation of RAFT consensus algorithm.
https://www.sofastack.tech/projects/sofa-jraft/
Apache License 2.0
3.53k stars 1.12k forks source link

(fix:pd) become a leader before the addLeaderStateListener #1062

Closed ye-xiaowei closed 6 months ago

ye-xiaowei commented 6 months ago

Motivation:

pd 启动之后会添加一个 onLeaderStart 的回调,如果在启动之后再添加则有可能 leader 已经选举好而且调用完了 onLeaderStart。

Modification:

将添加回调代码放置在 init 之前

Result:

Fixes #1060

sofastack-cla[bot] commented 6 months ago

Hi @ye-xiaowei, welcome to SOFAStack community, Please sign Contributor License Agreement!

After you signed CLA, we will automatically sync the status of this pull request in 3 minutes.

fengjiachun commented 6 months ago

@ye-xiaowei 非常感谢,你能签一下 CLA 吗?

ye-xiaowei commented 6 months ago

嗯嗯,我以为登录一下就好了

ye-xiaowei commented 6 months ago

@ye-xiaowei 非常感谢,你能签一下 CLA 吗?

现在的状态是签好了吗

fengjiachun commented 6 months ago

@ye-xiaowei 非常感谢,你能签一下 CLA 吗?

现在的状态是签好了吗

没,可能是 CLA 服务抽了,我先合并吧,非常感谢,cc @zhenjunMa