diff --git a/lerna.json b/lerna.json index 671935c34b..bbe4da4264 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.13.50", + "version": "2.13.51", "npmClient": "yarn", "packages": [ "packages/*", diff --git a/packages/account-portal b/packages/account-portal index e46a352a63..d6a1f89aa5 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit e46a352a6326a838faa00f912de069aee95d7300 +Subproject commit d6a1f89aa543bdce7acde5fbe4ce650a1344e2fe diff --git a/packages/backend-core/src/queue/queue.ts b/packages/backend-core/src/queue/queue.ts index 0657437a3b..b95dace5b2 100644 --- a/packages/backend-core/src/queue/queue.ts +++ b/packages/backend-core/src/queue/queue.ts @@ -47,7 +47,7 @@ export function createQueue( cleanupInterval = timers.set(cleanup, CLEANUP_PERIOD_MS) // fire off an initial cleanup cleanup().catch(err => { - console.error(`Unable to cleanup automation queue initially - ${err}`) + console.error(`Unable to cleanup ${jobQueue} initially - ${err}`) }) } return queue diff --git a/packages/backend-core/src/redis/redis.ts b/packages/backend-core/src/redis/redis.ts index 701e262091..d15453ba62 100644 --- a/packages/backend-core/src/redis/redis.ts +++ b/packages/backend-core/src/redis/redis.ts @@ -18,6 +18,7 @@ import { SelectableDatabase, getRedisConnectionDetails, } from "./utils" +import { logAlert } from "../logging" import * as timers from "../timers" const RETRY_PERIOD_MS = 2000 @@ -39,21 +40,16 @@ function pickClient(selectDb: number): any { return CLIENTS[selectDb] } -function connectionError( - selectDb: number, - timeout: NodeJS.Timeout, - err: Error | string -) { +function connectionError(timeout: NodeJS.Timeout, err: Error | string) { // manually shut down, ignore errors if (CLOSED) { return } - pickClient(selectDb).disconnect() CLOSED = true // always clear this on error clearTimeout(timeout) CONNECTED = false - console.error("Redis connection failed - " + err) + logAlert("Redis connection failed", err) setTimeout(() => { init() }, RETRY_PERIOD_MS) @@ -79,11 +75,7 @@ function init(selectDb = DEFAULT_SELECT_DB) { // start the timer - only allowed 5 seconds to connect timeout = setTimeout(() => { if (!CONNECTED) { - connectionError( - selectDb, - timeout, - "Did not successfully connect in timeout" - ) + connectionError(timeout, "Did not successfully connect in timeout") } }, STARTUP_TIMEOUT_MS) @@ -106,12 +98,13 @@ function init(selectDb = DEFAULT_SELECT_DB) { // allow the process to exit return } - connectionError(selectDb, timeout, err) + connectionError(timeout, err) }) client.on("error", (err: Error) => { - connectionError(selectDb, timeout, err) + connectionError(timeout, err) }) client.on("connect", () => { + console.log(`Connected to Redis DB: ${selectDb}`) clearTimeout(timeout) CONNECTED = true }) diff --git a/packages/worker/src/api/routes/global/tests/scim.spec.ts b/packages/worker/src/api/routes/global/tests/scim.spec.ts index 884625805c..56b7ca9f40 100644 --- a/packages/worker/src/api/routes/global/tests/scim.spec.ts +++ b/packages/worker/src/api/routes/global/tests/scim.spec.ts @@ -1,6 +1,6 @@ import tk from "timekeeper" import _ from "lodash" -import { mocks, structures } from "@budibase/backend-core/tests" +import { generator, mocks, structures } from "@budibase/backend-core/tests" import { ScimCreateUserRequest, ScimGroupResponse, @@ -14,9 +14,14 @@ import { events } from "@budibase/backend-core" jest.retryTimes(2, { logErrorsBeforeRetry: true }) jest.setTimeout(30000) -mocks.licenses.useScimIntegration() - describe("scim", () => { + beforeAll(async () => { + tk.freeze(mocks.date.MOCK_DATE) + mocks.licenses.useScimIntegration() + + await config.setSCIMConfig(true) + }) + beforeEach(async () => { jest.resetAllMocks() tk.freeze(mocks.date.MOCK_DATE) @@ -570,8 +575,15 @@ describe("scim", () => { beforeAll(async () => { groups = [] - for (let i = 0; i < groupCount; i++) { - const body = structures.scim.createGroupRequest() + const groupNames = generator.unique( + () => generator.word(), + groupCount + ) + + for (const groupName of groupNames) { + const body = structures.scim.createGroupRequest({ + displayName: groupName, + }) groups.push(await config.api.scimGroupsAPI.post({ body })) }