yumechi-no-kuni/src/notes-stats-child.ts

21 lines
342 B
TypeScript
Raw Normal View History

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