wip
This commit is contained in:
parent
e70fb71a04
commit
dc3c80e3ce
8 changed files with 140 additions and 7 deletions
26
src/daemons/notes-stats-child.ts
Normal file
26
src/daemons/notes-stats-child.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import Note from '../models/note';
|
||||
|
||||
const interval = 5000;
|
||||
|
||||
async function tick() {
|
||||
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);
|
||||
}
|
||||
|
||||
tick();
|
||||
|
||||
setInterval(tick, interval);
|
Loading…
Add table
Add a link
Reference in a new issue