iceshrimp-161sh/src/notes-stats-child.ts
syuilo 08d2324bb0 ✌️
2018-06-09 10:12:03 +09:00

23 lines
378 B
TypeScript

import Note from './models/note';
const interval = 5000;
setInterval(async () => {
const [all, local] = await Promise.all([Note.count({
createdAt: {
$gte: new Date(Date.now() - interval)
}
}), Note.count({
createdAt: {
$gte: new Date(Date.now() - interval)
},
'_user.host': null
})]);
const stats = {
all, local
};
process.send(stats);
}, interval);