Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复重复订阅问题 #159

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public class RepeaterModule implements Module, ModuleLifecycle {
private HeartbeatHandler heartbeatHandler;

private AtomicBoolean initialized = new AtomicBoolean(false);

private static List <SubscribeSupporter> subscribes = new ArrayList <>();

@Override
public void onLoad() throws Throwable {
Expand Down Expand Up @@ -186,8 +188,11 @@ private synchronized void initialize(RepeaterConfig config) {
}
}
RepeaterBridge.instance().build(repeaters);
// 先卸载消息订阅器
subscribes.forEach(subscribe -> subscribe.unRegister());
subscribes.clear();
// 装载消息订阅器
List<SubscribeSupporter> subscribes = lifecycleManager.loadSubscribes();
subscribes = lifecycleManager.loadSubscribes();
for (SubscribeSupporter subscribe : subscribes) {
subscribe.register();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public void onConfigChange(RepeaterConfig config) throws PluginLifeCycleExceptio
if (configTemporary == null) {
super.onConfigChange(config);
} else {
this.config = config;
super.onConfigChange(config);
List<Behavior> current = config.getJavaEntranceBehaviors();
List<Behavior> latest = configTemporary.getJavaEntranceBehaviors();
this.config = config;
super.onConfigChange(config);
if (JavaPluginUtils.hasDifference(current, latest)) {
reWatch0();
}
Expand Down