mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: status: auto-remove after 24hr
This commit is contained in:
1 parent
9524e56d01
commit
4904b16fa5
3 files changed
+6
-2
No files matched your search
@@ -3,6 +3,7 @@ import RecordModel from '../model/record';
|
||||
import DomainModel from '../model/domain';
|
||||
import * as DocumentModel from '../model/document';
|
||||
import db from '../service/db';
|
||||
import * as bus from '../service/bus';
|
||||
import { Route, Handler } from '../service/server';
|
||||
import UserModel from '../model/user';
|
||||
|
||||
@@ -64,6 +65,7 @@ class StatusUpdateHandler extends Handler {
|
||||
async post(args) {
|
||||
this.checkPriv(PRIV.PRIV_JUDGE);
|
||||
args.type = 'judge';
|
||||
args.updateAt = new Date();
|
||||
return coll.updateOne(
|
||||
{ mid: args.mid, type: 'judge' },
|
||||
{ $set: args },
|
||||
@@ -72,6 +74,8 @@ class StatusUpdateHandler extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
bus.once('app/started', () => coll.createIndex('updateAt', { expireAfterSeconds: 24 * 3600 }));
|
||||
|
||||
export async function apply() {
|
||||
Route('status', '/status', StatusHandler);
|
||||
Route('status_admin', '/.status', AdminStatusHandler);
|
||||
|
||||
Reference in new issue
Block a user