Skip to content

Commit

Permalink
Merge pull request #1286 from wowsims/fix/broken-wasm-stat-weights
Browse files Browse the repository at this point in the history
Add request ID to WASM stat weights logic
  • Loading branch information
1337LutZ authored Jan 6, 2025
2 parents 64ca4bc + 5c528c7 commit 2c3337d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ui/core/sim_concurrent.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SimRequest } from '../worker/types';
import {
ErrorOutcome,
ErrorOutcomeType,
Expand All @@ -12,7 +13,7 @@ import {
StatWeightsStatResultData,
} from './proto/api';
import { SimSignals } from './sim_signal_manager';
import { WorkerPool, WorkerProgressCallback } from './worker_pool';
import { generateRequestId, WorkerPool, WorkerProgressCallback } from './worker_pool';

class ConcurrentSimProgress {
readonly concurrency: number;
Expand Down Expand Up @@ -142,7 +143,7 @@ const makeAndSendRaidSimError = (err: string | ErrorOutcome, onProgress: WorkerP
console.error(err);
errRes.error = ErrorOutcome.create({ message: err });
} else {
if(err.message) console.error(err.message);
if (err.message) console.error(err.message);
errRes.error = err;
}
onProgress(ProgressMetrics.create({ finalRaidResult: errRes }));
Expand Down Expand Up @@ -223,7 +224,11 @@ export const runConcurrentStatWeights = async (
): Promise<StatWeightsResult> => {
console.log('Getting stat weight sim requests.');

const id = generateRequestId(SimRequest.statWeightsAsync);

const manualResponse = await workerPool.statWeightRequests(request);
manualResponse.baseRequest!.requestId = id;

if (signals.abort.isTriggered()) {
return makeAndSendWeightsError(ErrorOutcome.create({ type: ErrorOutcomeType.ErrorOutcomeAborted }), onProgress);
}
Expand All @@ -234,6 +239,8 @@ export const runConcurrentStatWeights = async (
let simsDone = 0;

for (const statReqData of manualResponse.statSimRequests) {
statReqData.requestLow!.requestId = id;
statReqData.requestHigh!.requestId = id;
iterationsTotal += statReqData.requestLow!.simOptions!.iterations + statReqData.requestHigh!.simOptions!.iterations;
simsTotal += 2;
}
Expand Down

0 comments on commit 2c3337d

Please sign in to comment.