MajekDev/HexNicks

MySQL Access is Synchronous

Closed this issue · 1 comments

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):

  • Server Implementation: Airplane
  • Minecraft Version 1.17.1
  • Java Version: 16
  • Plugin Version: 2.1.4

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!

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.