Skip to content

Commit

Permalink
partially fix MessagingManager shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Aug 8, 2023
1 parent 9f626b4 commit 26794a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,8 @@ protected void init() {
protected void shutdown() {
this.messagingManager.get().withPacketService(packetService -> {
packetService.queuePacket(this.injector.getInstance(PacketFactory.class).clearLocalPlayersPacket());
packetService.flushQueue(); // todo remove
});
// this.messagingManager.get().onShutdown(); // todo fix this taking so long
this.messagingManager.get().onShutdown();
ConcurrentUtil.shutdownExecutor(this.periodicTasks, TimeUnit.MILLISECONDS, 500);
this.profileCache.save();
this.profileResolver.shutdown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ public void withPacketService(final Consumer<PacketService> consumer) {
}

public void onShutdown() {
if (this.scheduledExecutor != null) {
ConcurrentUtil.shutdownExecutor(this.scheduledExecutor, TimeUnit.MILLISECONDS, 500);
}
if (this.packetService != null) {
this.packetService.flushQueue();
this.packetService.shutdown();
}
if (this.scheduledExecutor != null) {
ConcurrentUtil.shutdownExecutor(this.scheduledExecutor, TimeUnit.MILLISECONDS, 500);
}
this.messagingService.close();
// this.messagingService.close(); // todo - this is really slow, easier to just skip for now
}

private void initMessagingService(
Expand Down

0 comments on commit 26794a5

Please sign in to comment.