From e109334c59a0b237e87193669eabd34f64ad2698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 27 Oct 2023 01:08:53 +0900 Subject: [PATCH] =?UTF-8?q?fetchInstanceMetadata=E3=81=AE=E5=87=A6?= =?UTF-8?q?=E7=90=86=E4=B8=AD=E3=81=AB=E3=82=B5=E3=83=BC=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=81=8C=E5=BC=B7=E5=88=B6=E7=B5=82=E4=BA=86=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=9F=E5=A0=B4=E5=90=88Lock=E3=81=8C=E6=B0=B8=E9=81=A0?= =?UTF-8?q?=E3=81=AB=E8=A7=A3=E9=99=A4=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3=20(MisskeyIO#191)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/core/FetchInstanceMetadataService.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/core/FetchInstanceMetadataService.ts b/packages/backend/src/core/FetchInstanceMetadataService.ts index 8495719e8a..24efd91c70 100644 --- a/packages/backend/src/core/FetchInstanceMetadataService.ts +++ b/packages/backend/src/core/FetchInstanceMetadataService.ts @@ -52,13 +52,13 @@ export class FetchInstanceMetadataService { @bindThis public async tryLock(host: string): Promise { - const mutex = await this.redisClient.set(`fetchInstanceMetadata:mutex:${host}`, '1', 'GET'); + const mutex = await this.redisClient.set(`fetchInstanceMetadata:mutex:${host}`, '1', 'EX', 60 * 5, 'NX', 'GET'); return mutex !== '1'; } @bindThis - public unlock(host: string): Promise<'OK'> { - return this.redisClient.set(`fetchInstanceMetadata:mutex:${host}`, '0'); + public unlock(host: string): Promise { + return this.redisClient.del(`fetchInstanceMetadata:mutex:${host}`); } @bindThis