Skip to content

Commit

Permalink
chore: rename acc to collection for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
asharonbaltazar committed Nov 28, 2024
1 parent 290bd49 commit 10a729f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/lambda/sinkMainProcessors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ const getTransformedEventFromRecord = (
};

export const processAndIndex = async (kafkaRecords: KafkaRecord[], topicPartition: string) => {
const recordsToUpdate = kafkaRecords.reduce<TransformedEvent[]>((acc, kafkaRecord) => {
const recordsToUpdate = kafkaRecords.reduce<TransformedEvent[]>((collection, kafkaRecord) => {
console.log(`record: ${JSON.stringify(kafkaRecord, null, 2)}`);

try {
const { value } = kafkaRecord;

if (!value) {
return acc;
return collection;
}

const transformedEvent = getTransformedEventFromRecord(value, topicPartition, kafkaRecord);

if (transformedEvent) {
return acc.concat(transformedEvent);
return collection.concat(transformedEvent);
}
} catch (error) {
logError({
Expand All @@ -79,7 +79,7 @@ export const processAndIndex = async (kafkaRecords: KafkaRecord[], topicPartitio
});
}

return acc;
return collection;
}, []);

await bulkUpdateDataWrapper(recordsToUpdate, "main");
Expand Down

0 comments on commit 10a729f

Please sign in to comment.