mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-22 10:22:29 +00:00
Remove async option from SQLite#vacuum()
This commit is contained in:
parent
146f1b0dbf
commit
74db09e69e
@ -251,7 +251,7 @@ public class ShopChest extends JavaPlugin {
|
|||||||
|
|
||||||
if (database != null) {
|
if (database != null) {
|
||||||
if (database instanceof SQLite) {
|
if (database instanceof SQLite) {
|
||||||
((SQLite) database).vacuum(false);
|
((SQLite) database).vacuum();
|
||||||
}
|
}
|
||||||
|
|
||||||
database.disconnect();
|
database.disconnect();
|
||||||
|
@ -52,33 +52,20 @@ public class SQLite extends Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vacuums the database to reduce file size
|
* Vacuums the database synchronously to reduce file size
|
||||||
*
|
|
||||||
* @param async Whether the call should be executed asynchronously
|
|
||||||
*/
|
*/
|
||||||
public void vacuum(boolean async) {
|
public void vacuum() {
|
||||||
BukkitRunnable runnable = new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try (Connection con = dataSource.getConnection();
|
try (Connection con = dataSource.getConnection();
|
||||||
Statement s = con.createStatement()) {
|
Statement s = con.createStatement()) {
|
||||||
s.executeUpdate("VACUUM");
|
s.executeUpdate("VACUUM");
|
||||||
|
|
||||||
plugin.debug("Vacuumed SQLite database");
|
plugin.debug("Vacuumed SQLite database");
|
||||||
} catch (final SQLException ex) {
|
} catch (final SQLException ex) {
|
||||||
plugin.getLogger().severe("Failed to vacuum database");
|
plugin.getLogger().warning("Failed to vacuum database");
|
||||||
plugin.debug("Failed to vacuum database");
|
plugin.debug("Failed to vacuum database");
|
||||||
plugin.debug(ex);
|
plugin.debug(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (async) {
|
|
||||||
runnable.runTaskAsynchronously(plugin);
|
|
||||||
} else {
|
|
||||||
runnable.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
String getQueryCreateTableShops() {
|
String getQueryCreateTableShops() {
|
||||||
|
Loading…
Reference in New Issue
Block a user