mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
bump beta.10
This commit is contained in:
27 files changed
+143
-112
No files matched your search
@@ -59,7 +59,9 @@ class ScheduleModel {
|
||||
}
|
||||
|
||||
export async function apply(ctx: Context) {
|
||||
ctx.inject(['worker'], (c) => {
|
||||
ctx.on('domain/delete', (domainId) => coll.deleteMany({ domainId }));
|
||||
|
||||
await ctx.inject(['worker'], (c) => {
|
||||
c.worker.addHandler('task.daily', async (task) => {
|
||||
const pref: Record<string, number> = {};
|
||||
let start = Date.now();
|
||||
@@ -88,8 +90,6 @@ export async function apply(ctx: Context) {
|
||||
});
|
||||
});
|
||||
|
||||
ctx.on('domain/delete', (domainId) => coll.deleteMany({ domainId }));
|
||||
|
||||
if (process.env.NODE_APP_INSTANCE !== '0') return;
|
||||
if (!await ScheduleModel.count({ type: 'schedule', subType: 'task.daily' })) {
|
||||
await ScheduleModel.add({
|
||||
|
||||
@@ -179,9 +179,6 @@ async function cleanFiles() {
|
||||
}
|
||||
|
||||
export async function apply(ctx: Context) {
|
||||
ctx.inject(['worker'], (c) => {
|
||||
c.worker.addHandler('storage.prune', cleanFiles);
|
||||
});
|
||||
ctx.on('domain/delete', async (domainId) => {
|
||||
const [problemFiles, contestFiles, trainingFiles] = await Promise.all([
|
||||
StorageModel.list(`problem/${domainId}`),
|
||||
@@ -190,6 +187,9 @@ export async function apply(ctx: Context) {
|
||||
]);
|
||||
await StorageModel.del(problemFiles.concat(contestFiles).concat(trainingFiles).map((i) => i.path));
|
||||
});
|
||||
await ctx.inject(['worker'], (c) => {
|
||||
c.worker.addHandler('storage.prune', cleanFiles);
|
||||
});
|
||||
if (process.env.NODE_APP_INSTANCE !== '0') return;
|
||||
await db.ensureIndexes(
|
||||
StorageModel.coll,
|
||||
|
||||
Reference in new issue
Block a user