Adding warning back in for non-409 errors of user sync.
This commit is contained in:
parent
76bce0be1a
commit
4e560a1f32
|
@ -0,0 +1,9 @@
|
|||
export function is409Error(error: any) {
|
||||
if (typeof error === "object") {
|
||||
return error.status === 409 || error.message?.includes("409")
|
||||
} else if (typeof error === "number") {
|
||||
return error === 409
|
||||
} else if (typeof error === "string") {
|
||||
return error.includes("409")
|
||||
}
|
||||
}
|
|
@ -9,3 +9,4 @@ export * from "../constants/db"
|
|||
export { getGlobalDBName, baseGlobalDBName } from "../context"
|
||||
export * from "./lucene"
|
||||
export * as searchIndexes from "./searchIndexes"
|
||||
export * from "./errors"
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
import env from "../../../environment"
|
||||
import {
|
||||
db as dbCore,
|
||||
context,
|
||||
docUpdates,
|
||||
constants,
|
||||
logging,
|
||||
roles,
|
||||
} from "@budibase/backend-core"
|
||||
import { db as dbCore, context, logging, roles } from "@budibase/backend-core"
|
||||
import { User, ContextUser, UserGroup } from "@budibase/types"
|
||||
import { sdk as proSdk } from "@budibase/pro"
|
||||
import sdk from "../../"
|
||||
|
@ -105,7 +98,14 @@ export async function syncUsersToAllApps(userIds: string[]) {
|
|||
promises.push(syncUsersToApp(appId, finalUsers, groups))
|
||||
}
|
||||
}
|
||||
return await Promise.allSettled(promises)
|
||||
const resp = await Promise.allSettled(promises)
|
||||
const failed = resp.filter(promise => promise.status === "rejected")
|
||||
const reasons = failed
|
||||
.map(fail => (fail as PromiseRejectedResult).reason)
|
||||
.filter(reason => !dbCore.is409Error(reason))
|
||||
if (reasons.length > 0) {
|
||||
logging.logWarn("Failed to sync users to apps", reasons)
|
||||
}
|
||||
}
|
||||
|
||||
export async function syncApp(
|
||||
|
|
Loading…
Reference in New Issue