This commit is contained in:
parent
6eff8fde74
commit
c78945436e
20 changed files with 333 additions and 18 deletions
20
src/notes-stats-child.ts
Normal file
20
src/notes-stats-child.ts
Normal 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);
|
||||
Loading…
Add table
Add a link
Reference in a new issue