Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kafka produce #8664

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

kafka produce #8664

wants to merge 9 commits into from

Conversation

waynebruce0x
Copy link
Collaborator

No description provided.

@@ -396,6 +397,7 @@ export async function batchWriteWithAlerts(
const filteredItems: AWS.DynamoDB.DocumentClient.PutItemInputAttributeMap[] =
await checkMovement(items, previousItems);
await batchWrite(filteredItems, failOnError);
await produceKafkaTopics(filteredItems.filter((i) => i.SK == 0) as any[]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would mean, we write only current records? also, topic is missing here. Guessing this is sample code?

So, other than minor comments, the code looks good, we should give it a try and write some to kafka, so we can test writing to our DB

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the batch writes to dynamo are all duplicated (sk 0 and historical). Here I've filtered the items to sk0 only and then written them to all topics. This will write all topics.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I would rather split between 0 & with timestamp, write the timestamp ones too time series & without ts to current, I guess the mapping for both needs to be sent to mapping topic?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My worry is, what happens when you refill coin data, then it won't be sent to the topics right? Like filling nft prices a month ago

@@ -23,7 +23,7 @@ async function produceTopics(

items.map((item) => {
const { symbol, decimals } = item;
if (!symbol || !decimals) return;
if (!symbol || decimals == null) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typeof decimals !== 'number' is safer? or it will skip decimals which are string? hmm... maybe we can leave this as is
image

@waynebruce0x waynebruce0x marked this pull request as ready for review December 10, 2024 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants