mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Started using index creation task
This commit is contained in:
parent
84b723a44a
commit
fd22735084
@ -214,20 +214,32 @@ public abstract class SQLDB extends Database {
|
|||||||
private void setupDatabase() throws DBInitException {
|
private void setupDatabase() throws DBInitException {
|
||||||
try {
|
try {
|
||||||
createTables();
|
createTables();
|
||||||
|
registerIndexCreationTask();
|
||||||
Patch[] patches = patches();
|
registerPatchTask();
|
||||||
|
} catch (DBOpException | IllegalArgumentException e) {
|
||||||
try {
|
|
||||||
runnableFactory.create("Database Patch", new PatchTask(patches, locale, logger, errorHandler))
|
|
||||||
.runTaskLaterAsynchronously(TimeAmount.toTicks(5L, TimeUnit.SECONDS));
|
|
||||||
} catch (Exception ignore) {
|
|
||||||
// Task failed to register because plugin is being disabled
|
|
||||||
}
|
|
||||||
} catch (DBOpException e) {
|
|
||||||
throw new DBInitException("Failed to set-up Database", e);
|
throw new DBInitException("Failed to set-up Database", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerPatchTask() {
|
||||||
|
Patch[] patches = patches();
|
||||||
|
try {
|
||||||
|
runnableFactory.create("Database Patch", new PatchTask(patches, locale, logger, errorHandler))
|
||||||
|
.runTaskLaterAsynchronously(TimeAmount.toTicks(5L, TimeUnit.SECONDS));
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
// Task failed to register because plugin is being disabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerIndexCreationTask() {
|
||||||
|
try {
|
||||||
|
runnableFactory.create("Database Index Creation", new CreateIndexTask(this))
|
||||||
|
.runTaskAsynchronously();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
// Task failed to register because plugin is being disabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tables that contain data.
|
* Creates the tables that contain data.
|
||||||
* <p>
|
* <p>
|
||||||
|
Loading…
Reference in New Issue
Block a user