mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-26 00:46:44 -06:00
987168b863
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip
28 lines
595 B
TypeScript
28 lines
595 B
TypeScript
import { MoreThanOrEqual, getRepository } from 'typeorm';
|
|
import { Note } from '../models/entities/note';
|
|
import { initDb } from '../db/postgre';
|
|
|
|
const interval = 5000;
|
|
|
|
initDb().then(() => {
|
|
const Notes = getRepository(Note);
|
|
|
|
async function tick() {
|
|
const [all, local] = await Promise.all([Notes.count({
|
|
createdAt: MoreThanOrEqual(new Date(Date.now() - interval))
|
|
}), Notes.count({
|
|
createdAt: MoreThanOrEqual(new Date(Date.now() - interval)),
|
|
userHost: null
|
|
})]);
|
|
|
|
const stats = {
|
|
all, local
|
|
};
|
|
|
|
process.send!(stats);
|
|
}
|
|
|
|
tick();
|
|
|
|
setInterval(tick, interval);
|
|
});
|