mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-15 05:41:51 +08:00
Started using index creation task
This commit is contained in:
parent
84b723a44a
commit
fd22735084
@ -214,17 +214,29 @@ public abstract class SQLDB extends Database {
|
|||||||
private void setupDatabase() throws DBInitException {
|
private void setupDatabase() throws DBInitException {
|
||||||
try {
|
try {
|
||||||
createTables();
|
createTables();
|
||||||
|
registerIndexCreationTask();
|
||||||
|
registerPatchTask();
|
||||||
|
} catch (DBOpException | IllegalArgumentException e) {
|
||||||
|
throw new DBInitException("Failed to set-up Database", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerPatchTask() {
|
||||||
Patch[] patches = patches();
|
Patch[] patches = patches();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
runnableFactory.create("Database Patch", new PatchTask(patches, locale, logger, errorHandler))
|
runnableFactory.create("Database Patch", new PatchTask(patches, locale, logger, errorHandler))
|
||||||
.runTaskLaterAsynchronously(TimeAmount.toTicks(5L, TimeUnit.SECONDS));
|
.runTaskLaterAsynchronously(TimeAmount.toTicks(5L, TimeUnit.SECONDS));
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
// Task failed to register because plugin is being disabled
|
// Task failed to register because plugin is being disabled
|
||||||
}
|
}
|
||||||
} catch (DBOpException e) {
|
}
|
||||||
throw new DBInitException("Failed to set-up Database", e);
|
|
||||||
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user