drop lastCommunicatedAt of instance
This commit is contained in:
parent
7093573f0c
commit
c8bd139713
|
@ -0,0 +1,11 @@
|
||||||
|
export class removeLastCommunicatedAt1672704017999 {
|
||||||
|
name = 'removeLastCommunicatedAt1672704017999'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "lastCommunicatedAt"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "instance" ADD "lastCommunicatedAt" TIMESTAMP WITH TIME ZONE NOT NULL`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,7 +35,6 @@ export class FederatedInstanceService {
|
||||||
id: this.idService.genId(),
|
id: this.idService.genId(),
|
||||||
host,
|
host,
|
||||||
caughtAt: new Date(),
|
caughtAt: new Date(),
|
||||||
lastCommunicatedAt: new Date(),
|
|
||||||
}).then(x => this.instancesRepository.findOneByOrFail(x.identifiers[0]));
|
}).then(x => this.instancesRepository.findOneByOrFail(x.identifiers[0]));
|
||||||
|
|
||||||
this.cache.set(host, i);
|
this.cache.set(host, i);
|
||||||
|
|
|
@ -86,7 +86,7 @@ export default class FederationChart extends Chart<typeof schema> {
|
||||||
.where(`instance.host IN (${ subInstancesQuery.getQuery() })`)
|
.where(`instance.host IN (${ subInstancesQuery.getQuery() })`)
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT IN (:...blocked)', { blocked: meta.blockedHosts })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT IN (:...blocked)', { blocked: meta.blockedHosts })
|
||||||
.andWhere('instance.isSuspended = false')
|
.andWhere('instance.isSuspended = false')
|
||||||
.andWhere('instance.lastCommunicatedAt > :gt', { gt: new Date(Date.now() - (1000 * 60 * 60 * 24 * 30)) })
|
.andWhere('instance.isNotResponding = false')
|
||||||
.getRawOne()
|
.getRawOne()
|
||||||
.then(x => parseInt(x.count, 10)),
|
.then(x => parseInt(x.count, 10)),
|
||||||
this.instancesRepository.createQueryBuilder('instance')
|
this.instancesRepository.createQueryBuilder('instance')
|
||||||
|
@ -94,7 +94,7 @@ export default class FederationChart extends Chart<typeof schema> {
|
||||||
.where(`instance.host IN (${ pubInstancesQuery.getQuery() })`)
|
.where(`instance.host IN (${ pubInstancesQuery.getQuery() })`)
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT IN (:...blocked)', { blocked: meta.blockedHosts })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT IN (:...blocked)', { blocked: meta.blockedHosts })
|
||||||
.andWhere('instance.isSuspended = false')
|
.andWhere('instance.isSuspended = false')
|
||||||
.andWhere('instance.lastCommunicatedAt > :gt', { gt: new Date(Date.now() - (1000 * 60 * 60 * 24 * 30)) })
|
.andWhere('instance.isNotResponding = false')
|
||||||
.getRawOne()
|
.getRawOne()
|
||||||
.then(x => parseInt(x.count, 10)),
|
.then(x => parseInt(x.count, 10)),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -33,7 +33,6 @@ export class InstanceEntityService {
|
||||||
notesCount: instance.notesCount,
|
notesCount: instance.notesCount,
|
||||||
followingCount: instance.followingCount,
|
followingCount: instance.followingCount,
|
||||||
followersCount: instance.followersCount,
|
followersCount: instance.followersCount,
|
||||||
lastCommunicatedAt: instance.lastCommunicatedAt.toISOString(),
|
|
||||||
isNotResponding: instance.isNotResponding,
|
isNotResponding: instance.isNotResponding,
|
||||||
isSuspended: instance.isSuspended,
|
isSuspended: instance.isSuspended,
|
||||||
isBlocked: meta.blockedHosts.includes(instance.host),
|
isBlocked: meta.blockedHosts.includes(instance.host),
|
||||||
|
|
|
@ -75,12 +75,6 @@ export class Instance {
|
||||||
})
|
})
|
||||||
public latestRequestReceivedAt: Date | null;
|
public latestRequestReceivedAt: Date | null;
|
||||||
|
|
||||||
/**
|
|
||||||
* このインスタンスと最後にやり取りした日時
|
|
||||||
*/
|
|
||||||
@Column('timestamp with time zone')
|
|
||||||
public lastCommunicatedAt: Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* このインスタンスと不通かどうか
|
* このインスタンスと不通かどうか
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,11 +32,6 @@ export const packedFederationInstanceSchema = {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
},
|
},
|
||||||
lastCommunicatedAt: {
|
|
||||||
type: 'string',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
isNotResponding: {
|
isNotResponding: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
|
|
|
@ -86,7 +86,6 @@ export class DeliverProcessorService {
|
||||||
this.federatedInstanceService.registerOrFetchInstanceDoc(host).then(i => {
|
this.federatedInstanceService.registerOrFetchInstanceDoc(host).then(i => {
|
||||||
this.instancesRepository.update(i.id, {
|
this.instancesRepository.update(i.id, {
|
||||||
latestStatus: 200,
|
latestStatus: 200,
|
||||||
lastCommunicatedAt: new Date(),
|
|
||||||
isNotResponding: false,
|
isNotResponding: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,6 @@ export class InboxProcessorService {
|
||||||
this.federatedInstanceService.registerOrFetchInstanceDoc(authUser.user.host).then(i => {
|
this.federatedInstanceService.registerOrFetchInstanceDoc(authUser.user.host).then(i => {
|
||||||
this.instancesRepository.update(i.id, {
|
this.instancesRepository.update(i.id, {
|
||||||
latestRequestReceivedAt: new Date(),
|
latestRequestReceivedAt: new Date(),
|
||||||
lastCommunicatedAt: new Date(),
|
|
||||||
isNotResponding: false,
|
isNotResponding: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
case '-followers': query.orderBy('instance.followersCount', 'ASC'); break;
|
case '-followers': query.orderBy('instance.followersCount', 'ASC'); break;
|
||||||
case '+caughtAt': query.orderBy('instance.caughtAt', 'DESC'); break;
|
case '+caughtAt': query.orderBy('instance.caughtAt', 'DESC'); break;
|
||||||
case '-caughtAt': query.orderBy('instance.caughtAt', 'ASC'); break;
|
case '-caughtAt': query.orderBy('instance.caughtAt', 'ASC'); break;
|
||||||
case '+lastCommunicatedAt': query.orderBy('instance.lastCommunicatedAt', 'DESC'); break;
|
|
||||||
case '-lastCommunicatedAt': query.orderBy('instance.lastCommunicatedAt', 'ASC'); break;
|
|
||||||
|
|
||||||
default: query.orderBy('instance.id', 'DESC'); break;
|
default: query.orderBy('instance.id', 'DESC'); break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,15 +30,13 @@
|
||||||
<option value="-followers">{{ i18n.ts.followers }} ({{ i18n.ts.ascendingOrder }})</option>
|
<option value="-followers">{{ i18n.ts.followers }} ({{ i18n.ts.ascendingOrder }})</option>
|
||||||
<option value="+caughtAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.descendingOrder }})</option>
|
<option value="+caughtAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.descendingOrder }})</option>
|
||||||
<option value="-caughtAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.ascendingOrder }})</option>
|
<option value="-caughtAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.ascendingOrder }})</option>
|
||||||
<option value="+lastCommunicatedAt">{{ i18n.ts.lastCommunication }} ({{ i18n.ts.descendingOrder }})</option>
|
|
||||||
<option value="-lastCommunicatedAt">{{ i18n.ts.lastCommunication }} ({{ i18n.ts.ascendingOrder }})</option>
|
|
||||||
</MkSelect>
|
</MkSelect>
|
||||||
</FormSplit>
|
</FormSplit>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MkPagination v-slot="{items}" ref="instances" :key="host + state" :pagination="pagination">
|
<MkPagination v-slot="{items}" ref="instances" :key="host + state" :pagination="pagination">
|
||||||
<div class="dqokceoi">
|
<div class="dqokceoi">
|
||||||
<MkA v-for="instance in items" :key="instance.id" v-tooltip.mfm="`Last communicated: ${dateString(instance.lastCommunicatedAt)}\nStatus: ${getStatus(instance)}`" class="instance" :to="`/instance-info/${instance.host}`">
|
<MkA v-for="instance in items" :key="instance.id" v-tooltip.mfm="`Status: ${getStatus(instance)}`" class="instance" :to="`/instance-info/${instance.host}`">
|
||||||
<MkInstanceCardMini :instance="instance"/>
|
<MkInstanceCardMini :instance="instance"/>
|
||||||
</MkA>
|
</MkA>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,7 +22,7 @@ const fetching = ref(true);
|
||||||
|
|
||||||
const fetch = async () => {
|
const fetch = async () => {
|
||||||
const fetchedInstances = await os.api('federation/instances', {
|
const fetchedInstances = await os.api('federation/instances', {
|
||||||
sort: '+lastCommunicatedAt',
|
sort: '+latestRequestReceivedAt',
|
||||||
limit: 6,
|
limit: 6,
|
||||||
});
|
});
|
||||||
instances.value = fetchedInstances;
|
instances.value = fetchedInstances;
|
||||||
|
|
|
@ -153,7 +153,7 @@ onMounted(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
os.api('federation/instances', {
|
os.api('federation/instances', {
|
||||||
sort: '+lastCommunicatedAt',
|
sort: '+latestRequestReceivedAt',
|
||||||
limit: 25,
|
limit: 25,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
activeInstances = res;
|
activeInstances = res;
|
||||||
|
|
|
@ -44,7 +44,7 @@ let key = $ref(0);
|
||||||
|
|
||||||
const tick = () => {
|
const tick = () => {
|
||||||
os.api('federation/instances', {
|
os.api('federation/instances', {
|
||||||
sort: '+lastCommunicatedAt',
|
sort: '+latestRequestReceivedAt',
|
||||||
limit: 30,
|
limit: 30,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
instances.value = res;
|
instances.value = res;
|
||||||
|
|
|
@ -58,7 +58,7 @@ const fetching = ref(true);
|
||||||
|
|
||||||
const fetch = async () => {
|
const fetch = async () => {
|
||||||
const fetchedInstances = await os.api('federation/instances', {
|
const fetchedInstances = await os.api('federation/instances', {
|
||||||
sort: '+lastCommunicatedAt',
|
sort: '+latestRequestReceivedAt',
|
||||||
limit: 5,
|
limit: 5,
|
||||||
});
|
});
|
||||||
const fetchedCharts = await Promise.all(fetchedInstances.map(i => os.apiGet('charts/instance', { host: i.host, limit: 16, span: 'hour' })));
|
const fetchedCharts = await Promise.all(fetchedInstances.map(i => os.apiGet('charts/instance', { host: i.host, limit: 16, span: 'hour' })));
|
||||||
|
|
|
@ -54,7 +54,7 @@ function onInstanceClick(i) {
|
||||||
|
|
||||||
useInterval(() => {
|
useInterval(() => {
|
||||||
os.api('federation/instances', {
|
os.api('federation/instances', {
|
||||||
sort: '+lastCommunicatedAt',
|
sort: '+latestRequestReceivedAt',
|
||||||
limit: 25,
|
limit: 25,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
activeInstances = res;
|
activeInstances = res;
|
||||||
|
|
Loading…
Reference in New Issue