From 58a5c3d82bba65ad2bd85461ae813710d2adbe51 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 23 May 2022 00:29:45 +0100 Subject: [PATCH] turn off withCache for tests --- packages/worker/src/utilities/redis.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/worker/src/utilities/redis.js b/packages/worker/src/utilities/redis.js index 70a16a3be8..f43c2d6bdc 100644 --- a/packages/worker/src/utilities/redis.js +++ b/packages/worker/src/utilities/redis.js @@ -1,5 +1,6 @@ const { Client, utils } = require("@budibase/backend-core/redis") const { newid } = require("@budibase/backend-core/utils") +const env = require("../environment") function getExpirySecondsForDB(db) { switch (db) { @@ -119,7 +120,9 @@ exports.withCache = async (key, ttl, fetchFn) => { try { const fetchedValue = await fetchFn() - await cachingClient.store(key, fetchedValue, ttl) + if (!env.isTest()) { + await cachingClient.store(key, fetchedValue, ttl) + } return fetchedValue } catch (err) { console.error("Error calling fetch function", err)