Improve instance stats

This commit is contained in:
syuilo 2019-02-07 15:00:44 +09:00
parent 0bf602bae6
commit 336912e442
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
6 changed files with 78 additions and 6 deletions

View file

@ -1,22 +0,0 @@
import Instance, { IInstance } from '../models/instance';
import federationChart from '../chart/federation';
export default async function(host: string): Promise<IInstance> {
if (host == null) return null;
const index = await Instance.findOne({ host });
if (index == null) {
const i = await Instance.insert({
host,
caughtAt: new Date(),
system: null // TODO
});
federationChart.update(true);
return i;
} else {
return index;
}
}