diff --git a/servers/cu/src/bootstrap.js b/servers/cu/src/bootstrap.js index f0af648c5..d696ca473 100644 --- a/servers/cu/src/bootstrap.js +++ b/servers/cu/src/bootstrap.js @@ -84,7 +84,6 @@ export const createApis = async (ctx) => { const BROADCAST = 'workers' const workerBroadcast = new BroadcastChannel(BROADCAST).unref() const broadcastCloseStream = (streamId) => workerBroadcast.postMessage({ type: 'close-stream', streamId }) - const broadcastDumpEvaluations = () => workerBroadcast.postMessage({ type: 'dump-evaluations' }) const onCreateWorker = (type) => () => { const workerId = randomBytes(8).toString('hex') diff --git a/servers/cu/src/effects/ao-evaluation.js b/servers/cu/src/effects/ao-evaluation.js index ec813258a..b75833238 100644 --- a/servers/cu/src/effects/ao-evaluation.js +++ b/servers/cu/src/effects/ao-evaluation.js @@ -116,7 +116,7 @@ export function findEvaluationWith ({ db, loadEvaluation, EVALUATION_RESULT_DIR, fromPromise(async (result) => { if (EVALUATION_RESULT_DIR && EVALUATION_RESULT_BUCKET && !result.output) { const evaluationOutput = await findEvaluationFromDir({ processId, messageId }) - if (evaluationOutput == 'AWS Credentials not set') { + if (evaluationOutput === 'AWS Credentials not set') { return Rejected({ status: 404, message: 'Could not find evaluation: AWS Credentials not set' }).toPromise() } return { ...result, output: evaluationOutput } @@ -311,7 +311,7 @@ export function findEvaluationsWith ({ db, loadEvaluation, EVALUATION_RESULT_DIR return await Promise.all(results.map(async (result) => { if (result.processId && result.messageId && !result.output) { const evaluationOutput = await findEvaluationFromDir({ processId: result.processId, messageId: result.messageId }) - if (evaluationOutput == 'AWS Credentials not set') { + if (evaluationOutput === 'AWS Credentials not set') { return Rejected({ status: 404, message: 'Could not find evaluation: AWS Credentials not set' }) } return { ...result, output: evaluationOutput } diff --git a/servers/cu/src/effects/ao-evaluation.test.js b/servers/cu/src/effects/ao-evaluation.test.js index ea76bb8a0..002e7a618 100644 --- a/servers/cu/src/effects/ao-evaluation.test.js +++ b/servers/cu/src/effects/ao-evaluation.test.js @@ -4,7 +4,7 @@ import assert from 'node:assert' import { createTestLogger } from '../domain/logger.js' import { findEvaluationSchema, findEvaluationsSchema, findMessageBeforeSchema, saveEvaluationSchema } from '../domain/dal.js' -import { findMessageBeforeWith, findEvaluationFromDbWith, findEvaluationsWith, saveEvaluationWith, findEvaluationWith } from './ao-evaluation.js' +import { findMessageBeforeWith, findEvaluationsWith, saveEvaluationWith, findEvaluationWith } from './ao-evaluation.js' import { COLLATION_SEQUENCE_MAX_CHAR, EVALUATIONS_TABLE, MESSAGES_TABLE } from './db.js' const logger = createTestLogger({ name: 'ao-cu:readState' }) diff --git a/servers/cu/src/effects/worker/dumpEvaluations.js b/servers/cu/src/effects/worker/dumpEvaluations.js index 4eb3c0cff..403459ab7 100644 --- a/servers/cu/src/effects/worker/dumpEvaluations.js +++ b/servers/cu/src/effects/worker/dumpEvaluations.js @@ -1,5 +1,5 @@ import path from 'path' -import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3' +import { S3Client } from '@aws-sdk/client-s3' export function dumpEvaluationsWith ({ EVALUATION_RESULT_DIR, EVALUATION_RESULT_BUCKET, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, uploadFileToS3With, globSync, logger }) { return async (processId) => { diff --git a/servers/cu/src/effects/worker/loadEvaluation.js b/servers/cu/src/effects/worker/loadEvaluation.js index 9ad3936e0..29123abc1 100644 --- a/servers/cu/src/effects/worker/loadEvaluation.js +++ b/servers/cu/src/effects/worker/loadEvaluation.js @@ -1,5 +1,4 @@ import path from 'path' -import fs from 'fs' import { S3Client } from '@aws-sdk/client-s3' export function loadEvaluationWith ({ EVALUATION_RESULT_DIR, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, logger, existsSync, writeFileSync, loadEvaluationFromDir, loadEvaluationFromS3 }) { return async ({ messageId, processId }) => { diff --git a/servers/cu/src/effects/worker/loadEvaluation.test.js b/servers/cu/src/effects/worker/loadEvaluation.test.js index 54068899d..4c04bc740 100644 --- a/servers/cu/src/effects/worker/loadEvaluation.test.js +++ b/servers/cu/src/effects/worker/loadEvaluation.test.js @@ -98,6 +98,7 @@ describe('loadEvaluation', async () => { processId: 'test-process-id' }) assert.deepStrictEqual(result, { foo: 'bar' }) + assert.strictEqual(writeFileSyncCalled, true) assert.strictEqual(existsCalled, true) }) })