Skip to content

Commit

Permalink
properly finish filesHealthCheck script (#7359)
Browse files Browse the repository at this point in the history
  • Loading branch information
daneryl authored Oct 15, 2024
1 parent f585fc2 commit 3fc42b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 129 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"webpack-server": "node --no-experimental-fetch ./webpack/webpack.server.js",
"dev-worker": "node --no-experimental-fetch ./scripts/run.js ../app/worker.ts",
"dev-queue": "node --no-experimental-fetch ./scripts/run.js ../app/queueWorker.ts",
"files-healthcheck": "USE_CWD=true node --no-experimental-fetch ./scripts/run.js ../scripts/filesHealthCheck.ts",
"new-files-healthcheck": "tsx ./scripts/scripts.v2/filesHealthCheck.ts",
"generateAutomaticTranslationConfig": "node --no-experimental-fetch ./scripts/run.js ../scripts/scripts.v2/generateAutomaticTranslationConfig.ts",
"check-translations": "node --no-experimental-fetch ./scripts/checkTranslations.mjs",
Expand Down
110 changes: 0 additions & 110 deletions scripts/filesHealthCheck.ts

This file was deleted.

28 changes: 10 additions & 18 deletions scripts/scripts.v2/filesHealthCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ function print(content: any, error?: 'error') {
process[error ? 'stderr' : 'stdout'].write(`${LINE_PREFIX}${JSON.stringify(content)}\n`);
}

type FileRecord = { type: string; filename: string; url?: string };

function filterFilesInStorage(files: string[]) {
return files.filter(file => !file.endsWith('activity.log'));
}

async function handleTenant(tenantName: string) {
await tenants.run(async () => {
const s3Client = new S3Client({
Expand Down Expand Up @@ -93,20 +87,18 @@ async function handleTenant(tenantName: string) {
}, tenantName);
}

async function run() {
(async function run() {
await DB.connect(config.DBHOST, dbAuth);
await tenants.setupTenants();

if (!allTenants) {
return await handleTenant(tenant);
await handleTenant(tenant);
} else {
await Object.keys(tenants.tenants).reduce(async (prev, tenantName) => {
await prev;
await handleTenant(tenantName);
}, Promise.resolve());
}

await Object.keys(tenants.tenants).reduce(async (prev, tenantName) => {
await prev;
await handleTenant(tenantName);
}, Promise.resolve());
}

run().finally(() => {
process.exit();
});
await tenants.model?.closeChangeStream();
await DB.disconnect();
})();

0 comments on commit 3fc42b9

Please sign in to comment.