From 743832d39f64c6091b581c621d4bff99cf651fd8 Mon Sep 17 00:00:00 2001 From: Heikki Hellgren Date: Wed, 24 Apr 2024 12:09:54 +0300 Subject: [PATCH] fix: use string array for cache service Signed-off-by: Heikki Hellgren --- .../src/processor/NotificationsEmailProcessor.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts b/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts index d9f6b73e0a..5387d09c3d 100644 --- a/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts +++ b/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts @@ -23,7 +23,7 @@ import { LoggerService, } from '@backstage/backend-plugin-api'; import { Config, readDurationFromConfig } from '@backstage/config'; -import { durationToMilliseconds, JsonArray } from '@backstage/types'; +import { durationToMilliseconds } from '@backstage/types'; import { CATALOG_FILTER_EXISTS, CatalogClient, @@ -150,7 +150,7 @@ export class NotificationsEmailProcessor implements NotificationProcessor { ), ]); - await this.cache?.set('user-emails:all', ret as JsonArray, { + await this.cache?.set('user-emails:all', ret, { ttl: this.cacheTtl, }); return ret; @@ -160,9 +160,9 @@ export class NotificationsEmailProcessor implements NotificationProcessor { } private async getUserEmail(entityRef: string): Promise { - const cached = await this.cache?.get(`user-emails:${entityRef}`); + const cached = await this.cache?.get(`user-emails:${entityRef}`); if (cached) { - return [cached]; + return cached; } const { token } = await this.auth.getPluginRequestToken({ @@ -178,7 +178,7 @@ export class NotificationsEmailProcessor implements NotificationProcessor { } } - await this.cache?.set(`user-emails:${entityRef}`, ret[0], { + await this.cache?.set(`user-emails:${entityRef}`, ret, { ttl: this.cacheTtl, });