mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
vjudge: Provider.Langs (#852)
This commit is contained in:
1 parent
a1d392a409
commit
41e3f59579
8 files changed
+109
-101
No files matched your search
@@ -25,6 +25,11 @@ export default class MigrationService extends Service {
|
||||
this.channels[name] = s;
|
||||
}
|
||||
|
||||
dontWait(func: () => Promise<void | boolean>, name: string) {
|
||||
(func as any).dontWait = name;
|
||||
return func;
|
||||
}
|
||||
|
||||
async doUpgrade() {
|
||||
this.called = true;
|
||||
for (const channel in this.channels) {
|
||||
@@ -45,8 +50,16 @@ export default class MigrationService extends Service {
|
||||
continue;
|
||||
}
|
||||
logger.info('Upgrading database [%s]: from %d to %d', channel, dbVer, expected);
|
||||
const result = await func();
|
||||
if (!result) break;
|
||||
if ('dontWait' in func) {
|
||||
logger.info('[Background Task]');
|
||||
// For those scripts we don't really care if they fail
|
||||
func().then(() => {
|
||||
logger.info('Background Task Completed [%s]: from %d to %d', channel, func.dontWait, expected);
|
||||
}).catch(logger.error);
|
||||
} else {
|
||||
const result = await func();
|
||||
if (!result) break;
|
||||
}
|
||||
dbVer++;
|
||||
await system.set(name, dbVer);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user