Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -2,8 +2,8 @@ import { loadWorkerConfig, type EnvRecord, type WorkerConfigDiagnostic, type Wor
|
||||
import { getDbClient } from "@hivegrid/db/client.server";
|
||||
import { isWorkerQueueGroup, parseRedisUrl, type QueueName, type WorkerQueueGroup } from "@hivegrid/queue";
|
||||
import { Queue } from "bullmq";
|
||||
import { getWorkerQueueNames } from "./queues.js";
|
||||
import { getMissingWorkerStorageEnv } from "./storage.js";
|
||||
import { getWorkerQueueNames, resolveImportQueueRuntimeMode } from "./queues.js";
|
||||
import { getMissingWorkerGdprExportStorageEnv, getMissingWorkerStorageEnv } from "./storage.js";
|
||||
|
||||
export type WorkerHealthEnv = EnvRecord;
|
||||
|
||||
@@ -69,7 +69,10 @@ export async function buildWorkerHealthReport(
|
||||
checkRedisReadiness(shouldProbeRedis, config.redis.url, dependencies.redisProbe),
|
||||
checkDatabaseReadiness(shouldProbeDatabase, dependencies.databaseProbe),
|
||||
]);
|
||||
const storageReadiness = checkStorageReadiness(config.enabled && env.EXPORT_RETENTION_QUEUE_ENABLED === "true", env);
|
||||
const storageReadiness = checkStorageReadiness(
|
||||
config.enabled && (env.EXPORT_RETENTION_QUEUE_ENABLED === "true" || ["full", "portal-gdpr-export"].includes(resolveImportQueueRuntimeMode(env))),
|
||||
env
|
||||
);
|
||||
const mailReadiness = checkMailReadiness(config.enabled, config.mailjet.configured, isMailProviderRequired(env), env);
|
||||
const importReadiness = checkImportReadiness(config.enabled && result.ok && getWorkerGroup(env) === "import", env);
|
||||
const pluginRuntimeReadiness = checkPluginRuntimeReadiness(config.enabled && result.ok, getWorkerGroup(env), env);
|
||||
@@ -309,10 +312,15 @@ function checkImportReadiness(shouldCheck: boolean, env: WorkerHealthEnv): { con
|
||||
|
||||
const importEnabled = env.IMPORT_QUEUE_ENABLED === "true";
|
||||
const runtimeReady = env.IMPORT_QUEUE_RUNTIME_READY === "true";
|
||||
if (!importEnabled && !runtimeReady) {
|
||||
const mode = resolveImportQueueRuntimeMode(env);
|
||||
if (mode === "idle") {
|
||||
return { configured: false, errors: [], status: "skipped" };
|
||||
}
|
||||
|
||||
if (mode === "portal-gdpr-export" || mode === "full") {
|
||||
return { configured: true, errors: [], status: "ready" };
|
||||
}
|
||||
|
||||
if (!importEnabled || !runtimeReady) {
|
||||
const errors: string[] = [];
|
||||
if (!importEnabled) {
|
||||
@@ -332,7 +340,11 @@ function checkImportReadiness(shouldCheck: boolean, env: WorkerHealthEnv): { con
|
||||
};
|
||||
}
|
||||
|
||||
return { configured: true, errors: [], status: "ready" };
|
||||
return {
|
||||
configured: false,
|
||||
errors: ["WORKER_QUEUE_GROUP:invalid-import-runtime-mode:Import worker queue gates do not resolve to an allowed runtime mode."],
|
||||
status: "misconfigured",
|
||||
};
|
||||
}
|
||||
|
||||
function checkStorageReadiness(shouldCheck: boolean, env: WorkerHealthEnv): { configured: boolean; errors: string[]; status: WorkerHealthStorageStatus } {
|
||||
@@ -340,11 +352,18 @@ function checkStorageReadiness(shouldCheck: boolean, env: WorkerHealthEnv): { co
|
||||
return { configured: false, errors: [], status: "skipped" };
|
||||
}
|
||||
|
||||
const missing = getMissingWorkerStorageEnv(env);
|
||||
const importMode = resolveImportQueueRuntimeMode(env);
|
||||
const ownsGdprExports = importMode === "full" || importMode === "portal-gdpr-export";
|
||||
const missing = ownsGdprExports ? getMissingWorkerGdprExportStorageEnv(env) : getMissingWorkerStorageEnv(env);
|
||||
if (missing.length > 0) {
|
||||
const requiredBy = [
|
||||
...(env.EXPORT_RETENTION_QUEUE_ENABLED === "true" ? ["EXPORT_RETENTION_QUEUE_ENABLED=true"] : []),
|
||||
...(importMode === "portal-gdpr-export" ? ["PORTAL_GDPR_EXPORT_QUEUE_ENABLED=true"] : []),
|
||||
...(importMode === "full" ? ["the full import runtime owns GDPR export jobs"] : []),
|
||||
].join(" or ");
|
||||
return {
|
||||
configured: false,
|
||||
errors: missing.map((name) => `${name}:missing-storage-config:Required when EXPORT_RETENTION_QUEUE_ENABLED=true.`),
|
||||
errors: missing.map((name) => `${name}:missing-storage-config:Required when ${requiredBy}.`),
|
||||
status: "misconfigured",
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user