Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Feat(Site Launch): Mock calls to Amplify #704
Feat(Site Launch): Mock calls to Amplify #704
Changes from 9 commits
441db63
efd4245
84125df
b99eef4
e0ce609
d796b4b
9f6870c
1260b7e
cd97d22
602b6f8
10e26d1
9e66101
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This is going to block the main thread for 90s right?
Seems like "todo: push this check into a queue-like system when integrating this with cms" is crucial for integration with CMS
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.
hmm correct me if I am wrong, but set setTimeout does not block the main thread right?
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.
@kishore03109 hmm, you can do a simple test on console -
"DONE" wont be printed until the promise is done. you might want to double check the actual behaviour on this
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.
Hmm wait isnt that the point? I want to only resolve this after 90 seconds to give Amplify enough time to generate the DNS results
eg for the code
in the console log, we would see:
STARTING
ENDED
PROMISE DONE
thus the other functions in the thread will not be blocked?
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.
think the confusion stems from the
await
- if youawait
in an async function:the main thread is free to continue on until the result of the
await
-ed promise is used (ie,const y = x
). however, because weawait
here, i think we'll pause execution for 90sThere 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.
@kishore03109 if you added
await
on test:it will wait for promise to be done first
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.
@harishv7, for ease of mind, I have made the main caller (
this.handleSiteLaunchResults
) function non-blocking (ie, removing theawait
), since we technically can run this async after returning the 200 response. However, this means that any error thrown by this will not be caught byhandleSiteLaunchFormRequest
. Therefore, I am wrapping a try catch around and logging the error to any unintended effects of some unexpected error. Ideally, during an error, this would return something to the user, but I think this can be revisited when we are integrating the features with the frontend!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 think this is non-blocking - top-most caller is
handleSiteLaunchFormRequest
informsgSiteLaunch
and it callsthis.handleSiteLaunchResults(formResponses, submissionId)
withoutawait
(which calls this method later on)