-
Notifications
You must be signed in to change notification settings - Fork 1
Fix misc ddex4.0 and sme processing bugs #7
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
base: main
Are you sure you want to change the base?
Conversation
// MessageRecipient (Source) | ||
const messageRecipient = $('<MessageRecipient></MessageRecipient>') | ||
messageRecipient.append($(`<PartyId>${source.toUpperCase()}</PartyId>`)) | ||
const resolvedRecipient = recipientPartyId || (source === 'sme' ? 'PADPIDA2007040502I' : source.toUpperCase()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what our prototype/roughness comfort level is in this repo. But this seems like it should be a constant and/or some kind of function that can determine the value. Having the source check for a particular label hard-coded in here feels cryptic and hard to maintain :-D
if (isSuccess) { | ||
releaseStatus.append($('<ReleaseStatus>SuccessfullyIngestedByReleaseDistributor</ReleaseStatus>')) | ||
const acknowledgement = $('<Acknowledgement></Acknowledgement>') | ||
acknowledgement.append($('<MessageType>NewReleaseMessage</MessageType>')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why it feels wild to me that we're doing all of these lines with string literals for tag names to incrementally build XML. This def feels like something that could eventually be append(Tags.MessageType, Types.NewRelease)
etc...
But again, probably not that point in dev for this repo...
isSuccess: false, | ||
error: errorMessage | ||
error: errorMessage, | ||
recipientPartyId: source === 'sme' ? 'PADPIDA2007040502I' : undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that I've seen it thrice, definitely should be a helper
// Handle case where there are common prefixes (folder structure) | ||
if (prefixes && prefixes.length > 0) { | ||
const batchSize = 20 | ||
const batchSize = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super curious how many simultaneous connections the node server can have open to a single host and whether 100 things will actually fire off at once.
}) | ||
) | ||
|
||
// Process all files in chronological order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will admit I was at first confused as to how this is ensuring chronological ordering haha. But I see that's in the implementation details of processS3Contents
.sort((a, b) => { | ||
const timestampA = a!.messageTimestamp || '' | ||
const timestampB = b!.messageTimestamp || '' | ||
return timestampA.localeCompare(timestampB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resisting the urge to go down a rabbit hole to determine if locale actually matters when comparing timestamps strings.
Also, feels like we maybe shouldn't do that lexicographically but should parse them to actual numbers and do the comparison with plain ole gt/lt
for (const file of sortedFiles) { | ||
const xmlUrl = `s3://` + join(bucket, file!.key) | ||
console.log('parsing', xmlUrl, 'timestamp:', file!.messageTimestamp) | ||
const releases = (await parseDdexXml(source, xmlUrl, file!.xml)) || [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just curious, the parsing of the files changes based on the order you parse them in? Or is it just the processing of them afterwards that matters? Feels like a serial process of parsing files is slower than it could be. But if this is doing more than parsing, I could see why it matters.
const Bucket = s3url.host | ||
const Key = s3url.pathname.substring(1) | ||
const source = sources.findByXmlUrl(xmlUrl) | ||
const s3 = dialS3(source) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call 1-900-my-buckt today, act now!
const source = sources.findByXmlUrl(xmlUrl) | ||
const s3 = dialS3(source) | ||
const command = new GetObjectCommand({ Bucket, Key }) | ||
const signed = await getSignedUrl(s3 as any, command as any, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
por que any
s
releases: DDEXRelease[], | ||
isSuccess: boolean, | ||
error?: string | ||
error?: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this typical TS? or some other kind of error?
This was painful!
Tested via prod s3 dump.
using the correct source config
Manually reviewed recent dump