MajekDev / HexNicks

Nickname plugin with hex color code and gradient support.
MIT License
27 stars 15 forks source link

MySQL Access is Synchronous #40

Closed Starmism closed 2 years ago

Starmism commented 2 years ago

Describe the bug If you're using the MySQL integration of the plugin, everything it does is done synchronously on the main thread, which halts the server until it is completed. This was causing major lag spikes on every PlayerJoin event because it was updating the cache with their username. Spark Report

To Reproduce Steps to reproduce the behavior:

  1. Enable MySQL in the config and fill out your settings
  2. Get a bunch of people to set nicknames.
  3. Watch them join the server and watch the server pause.

Expected behavior This should all be handled asynchronously away from the main thread with the use of BukkitRunnables or likewise.

Software (please complete the following information):

Additional context I've already fixed this bug on my copy, but it is behind a few git commits and drastically changes a bunch of stuff, so if I do manage to upload it to GitHub I will link it here. Otherwise, I am interested in seeing how you address this, especially the placeholder portion!

Majekdor commented 2 years ago

This should be fixed here. I tested it and my spark report looked fine but I have no way to test with tons of players.