Skip to content

Commit 6b5744a

Browse files
authored
fix: deduplicate results to process before processing (#3428)
Signed-off-by: Uroš Marolt <uros@marolt.me>
1 parent 5e46a0b commit 6b5744a

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

services/apps/data_sink_worker/src/service/dataSink.service.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,21 @@ export default class DataSinkService extends LoggerBase {
247247
}
248248

249249
public async processResults(
250-
batch: { resultId: string; data: IResultData | undefined; created: boolean }[],
250+
resultsToProcess: { resultId: string; data: IResultData | undefined; created: boolean }[],
251251
postProcess = true,
252252
): Promise<void> {
253+
const batch: { resultId: string; data: IResultData | undefined; created: boolean }[] = []
254+
for (const result of resultsToProcess) {
255+
const filtered = resultsToProcess.filter((r) => r.resultId === result.resultId)
256+
if (filtered.length > 1) {
257+
this.log.warn(
258+
{ resultId: result.resultId },
259+
'Found multiple results for the same result id!',
260+
)
261+
}
262+
batch.push(filtered[0])
263+
}
264+
253265
this.log.trace(`[RESULTS] Processing ${batch.length} results!`)
254266
const start = performance.now()
255267

0 commit comments

Comments
 (0)