From af095cd80194e391587167d414e5ac78bad17569 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sun, 21 Oct 2018 13:00:09 -0600 Subject: [PATCH] Clear the correct cache for webhooks --- src/MemoryCache.ts | 3 ++- src/api/admin/AdminWebhooksService.ts | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/MemoryCache.ts b/src/MemoryCache.ts index 7437299..ff4c724 100644 --- a/src/MemoryCache.ts +++ b/src/MemoryCache.ts @@ -49,4 +49,5 @@ export const CACHE_WIDGET_TITLES = "widget-titles"; export const CACHE_FEDERATION = "federation"; export const CACHE_IRC_BRIDGE = "irc-bridge"; export const CACHE_STICKERS = "stickers"; -export const CACHE_TELEGRAM_BRIDGE = "telegram-bridge"; \ No newline at end of file +export const CACHE_TELEGRAM_BRIDGE = "telegram-bridge"; +export const CACHE_WEBHOOKS_BRIDGE = "webhooks-bridge"; \ No newline at end of file diff --git a/src/api/admin/AdminWebhooksService.ts b/src/api/admin/AdminWebhooksService.ts index 2aa52b1..7b1396e 100644 --- a/src/api/admin/AdminWebhooksService.ts +++ b/src/api/admin/AdminWebhooksService.ts @@ -1,6 +1,6 @@ import { GET, Path, PathParam, POST, QueryParam } from "typescript-rest"; import { AdminService } from "./AdminService"; -import { Cache, CACHE_INTEGRATIONS, CACHE_TELEGRAM_BRIDGE } from "../../MemoryCache"; +import { Cache, CACHE_INTEGRATIONS, CACHE_WEBHOOKS_BRIDGE } from "../../MemoryCache"; import { LogService } from "matrix-js-snippets"; import { ApiError } from "../ApiError"; import WebhookBridgeRecord from "../../db/models/WebhookBridgeRecord"; @@ -76,7 +76,7 @@ export class AdminWebhooksService { LogService.info("AdminWebhooksService", userId + " updated Webhook Bridge " + bridge.id); - Cache.for(CACHE_TELEGRAM_BRIDGE).clear(); + Cache.for(CACHE_WEBHOOKS_BRIDGE).clear(); Cache.for(CACHE_INTEGRATIONS).clear(); return this.getBridge(scalarToken, bridge.id); } @@ -99,7 +99,7 @@ export class AdminWebhooksService { }); LogService.info("AdminWebhooksService", userId + " created a new Webhook Bridge with provisioning URL " + request.provisionUrl); - Cache.for(CACHE_TELEGRAM_BRIDGE).clear(); + Cache.for(CACHE_WEBHOOKS_BRIDGE).clear(); Cache.for(CACHE_INTEGRATIONS).clear(); return this.getBridge(scalarToken, bridge.id); }