GeorgH93 / Minepacks

Free and reliable backpack plugin for Bukkit/Spigot/Paper
https://www.spigotmc.org/resources/19286/
GNU General Public License v3.0
170 stars 75 forks source link

Take the update checker off the main thread please #310

Open ZepsiZola opened 6 months ago

ZepsiZola commented 6 months ago

Every now and then when the server is shutting down or starting up (I forget if it's both or just one or the other), the shutdown/startup process is halted. I check the logs and I can see that this halting occurs when the Minepacks plugin is being enabled/disabled. Specifcally the halting occurs on the update checker part of the process. I'm assuming the plugin sometimes is not able to contact a site and as a result, the plugin disabling/enabling process can't continue, which then halts the startup/shutdown process. Usually plugin devs move their network stuff off the main thread because if it's on the main thread and a connection can't be reached, it just causes chaos. Update checker does not need to be on the main thread.

GeorgH93 commented 4 months ago

The update check isn't on the main thread. However, on shutdown it will wait for it to finish, preventing broken updates in case someone kills the server early. I guess I could add a config option to not check for updates on shutdown. Also, maybe reduce the timeouts for the checks.