-
Notifications
You must be signed in to change notification settings - Fork 2
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
invoke lambda function in pixel handler for #35 #36
Conversation
Codecov Report
@@ Coverage Diff @@
## master #36 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 105 108 +3
=========================================
+ Hits 105 108 +3
Continue to review full report at Codecov.
|
lambda = System.get_env("AWS_LAMBDA_FUNCTION") | ||
ExAws.Lambda.invoke(lambda, payload, "no_context") | ||
|> ExAws.request(region: System.get_env("AWS_REGION")) | ||
|> IO.inspect(label: "ExAws.Lambda ping response") |
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.
Not sure if you want to keep this IO.inspect
uncommented
|> IO.inspect(label: "ExAws.Lambda ping response") | |
# |> IO.inspect(label: "ExAws.Lambda ping response") |
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.
For now I'm happy to leave these kinds of logs in this App.
When we are paying for the storage of logs, we will have to be strict about them
and will probably have a pre-commit hook/check to not allow uncommented IO.inspect
. 👍
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.
Looks good and it makes sense to "wake up" the lambda when the pixel
endpoint is called.
I didn't know that lambdas could be become "inactive".
@SimonLab yeah, Lambda functions also go to "sleep" after a period of inactivity to save RAM on the VM running the function. The function gets re-loaded into RAM "just-in-time" for a fresh execution but it stays "warm" for between 5 and 45 mins after that depending on the scheduler (i.e. how many people are using Lambda in your region) but that is all "black box" to the developer. We tested it extensively at TC, that's how I know about it. |
This PR addresses issue #35
Will speed up sending email when the person authenticates or registers. 🚀
The way you can visually check that this is working is by visiting: https://dwylauth.herokuapp.com
It does not "block" the UI in the Auth App it just makes the request for the "pixel" in the background.
The point is to "Wake" the https://dwylmail.herokuapp.com App so that after successfully authenticating with the Auth app, the email is sent as fast as possible. If you open the Email dashboard in a different tab you'll notice that it loads instantly:
Obviously this is a stop gap until we deploy all our apps to VPS: dwyl/learn-devops#59