summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/FederatedInstanceService.ts
diff options
context:
space:
mode:
authorokayurisotto <okayurisotto@proton.me>2023-07-08 07:08:16 +0900
committerGitHub <noreply@github.com>2023-07-08 07:08:16 +0900
commitd84796588c1472334ddaf696a817f015c245ce44 (patch)
tree45caa2d8659d35b90bc3f36170e764aa5eb90b70 /packages/backend/src/core/FederatedInstanceService.ts
parentperf(backend): Improve performance of FetchInstanceMetadata (#11128) (diff)
downloadsharkey-d84796588c1472334ddaf696a817f015c245ce44.tar.gz
sharkey-d84796588c1472334ddaf696a817f015c245ce44.tar.bz2
sharkey-d84796588c1472334ddaf696a817f015c245ce44.zip
cleanup: trim trailing whitespace (#11136)
* cleanup: trim trailing whitespace * update(`.editorconfig`) --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/backend/src/core/FederatedInstanceService.ts')
-rw-r--r--packages/backend/src/core/FederatedInstanceService.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/backend/src/core/FederatedInstanceService.ts b/packages/backend/src/core/FederatedInstanceService.ts
index 3603d59dcc..a762038942 100644
--- a/packages/backend/src/core/FederatedInstanceService.ts
+++ b/packages/backend/src/core/FederatedInstanceService.ts
@@ -43,19 +43,19 @@ export class FederatedInstanceService implements OnApplicationShutdown {
@bindThis
public async fetch(host: string): Promise<Instance> {
host = this.utilityService.toPuny(host);
-
+
const cached = await this.federatedInstanceCache.get(host);
if (cached) return cached;
-
+
const index = await this.instancesRepository.findOneBy({ host });
-
+
if (index == null) {
const i = await this.instancesRepository.insert({
id: this.idService.genId(),
host,
firstRetrievedAt: new Date(),
}).then(x => this.instancesRepository.findOneByOrFail(x.identifiers[0]));
-
+
this.federatedInstanceCache.set(host, i);
return i;
} else {
@@ -74,7 +74,7 @@ export class FederatedInstanceService implements OnApplicationShutdown {
.then((response) => {
return response.raw[0];
});
-
+
this.federatedInstanceCache.set(result.host, result);
}