From 90dbc73132f22888a60628d921c92f938499bd7b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Nov 2022 16:36:17 +0100 Subject: [PATCH] Type result --- server/lib/redis.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server/lib/redis.ts b/server/lib/redis.ts index 4d7947d40..c0e9aece7 100644 --- a/server/lib/redis.ts +++ b/server/lib/redis.ts @@ -411,13 +411,9 @@ class Redis { } private async setValue (key: string, value: string, expirationMilliseconds?: number) { - let result - - if (expirationMilliseconds !== undefined) { - result = await this.client.set(this.prefix + key, value, 'PX', expirationMilliseconds) - } else { - result = await this.client.set(this.prefix + key, value) - } + const result = expirationMilliseconds !== undefined + ? await this.client.set(this.prefix + key, value, 'PX', expirationMilliseconds) + : await this.client.set(this.prefix + key, value) if (result !== 'OK') throw new Error('Redis set result is not OK.') }