This commit is contained in:
syuilo 2018-06-09 04:14:26 +09:00
parent 6eff8fde74
commit c78945436e
20 changed files with 333 additions and 18 deletions

20
src/notes-stats-child.ts Normal file
View file

@ -0,0 +1,20 @@
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);