WiIIiam278 / HuskHomes

The powerful & intuitive homes, warps, and teleportation suite
https://william278.net/project/huskhomes
Apache License 2.0
127 stars 82 forks source link

fix: #658 Retry when the table is locked #683

Closed CodeZhangBorui closed 3 months ago

CodeZhangBorui commented 3 months ago

Fix #658

Proper handling of table locking exceptions to prevent database disconnections.

When a table lock exception is thrown, it will attempt to retry once after 500 ms, for a total of 20 retries. Other SQLExceptions will be thrown directly to allow for handling at the upper execution stack.

Tests well on my server's production environment.

Please note that I am not a professional Java programmer, but this issue is quite serious and I urgently need to fix it on my server. Therefore, I have made an attempt to repair the code and I'm sharing my code behind the fix.

If there are any issues with my code, please make the necessary corrections. Thank you!

WiIIiam278 commented 3 months ago

Closing in favor of https://github.com/WiIIiam278/HuskHomes/commit/1c644b120e02d5fea33e50698303d0ee8edc31ab for now - I'd like to monitor the effects of this change first. Can revisit if we still have issues.