turn off withCache for tests
This commit is contained in:
parent
6d3aa6a806
commit
1ce66bd860
|
@ -1,5 +1,6 @@
|
||||||
const { Client, utils } = require("@budibase/backend-core/redis")
|
const { Client, utils } = require("@budibase/backend-core/redis")
|
||||||
const { newid } = require("@budibase/backend-core/utils")
|
const { newid } = require("@budibase/backend-core/utils")
|
||||||
|
const env = require("../environment")
|
||||||
|
|
||||||
function getExpirySecondsForDB(db) {
|
function getExpirySecondsForDB(db) {
|
||||||
switch (db) {
|
switch (db) {
|
||||||
|
@ -119,7 +120,9 @@ exports.withCache = async (key, ttl, fetchFn) => {
|
||||||
try {
|
try {
|
||||||
const fetchedValue = await fetchFn()
|
const fetchedValue = await fetchFn()
|
||||||
|
|
||||||
|
if (!env.isTest()) {
|
||||||
await cachingClient.store(key, fetchedValue, ttl)
|
await cachingClient.store(key, fetchedValue, ttl)
|
||||||
|
}
|
||||||
return fetchedValue
|
return fetchedValue
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error calling fetch function", err)
|
console.error("Error calling fetch function", err)
|
||||||
|
|
Loading…
Reference in New Issue