-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add a dedicated lambda
bin
#218
base: main
Are you sure you want to change the base?
Conversation
@@ -236,7 +237,7 @@ async fn list_inner( | |||
let votes = q["votes"].as_u64().expect("votes is a number") as f64; | |||
// max so that even if vote count somehow got to 0, count it as 1 | |||
let votes = votes.max(1.); | |||
let exp = (-1. * dt as f64).exp_m1() + 1.; |
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.
clippy yelled at me
// NB! If you are creating entries manually via the DynamoDB Web UI (or CLI) | ||
// when developing and testing, make sure you are putting valid ulids as ids, | ||
// since the db server will only check that `id` respects the `S` type, and so | ||
// will not error back to you when you are saving a question (say, via Web UI) | ||
// with `id="string-that-is-not-valid-ulid"`. | ||
ulid::Ulid::from_string(id).expect("all ids to be valid ulids in the table") |
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.
addresses thread
--release
not speciallambda
bin
cargo lambda build --release --arm64 | ||
cargo lambda deploy --env-var RUST_LOG=info,tower_http=debug,wewerewondering_api=trace --profile qa | ||
cargo lambda build --release --arm64 --bin lambda | ||
cargo lambda deploy --env-var RUST_LOG=info,tower_http=debug,lambda=trace --profile qa --binary-name lambda |
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.
lambda=trace
might be a bit ambiguous, but lambda
here is the app's name
lambda
binlambda
bin
This is the first iteration on #202
I have not found a way to provide flags/args to the lambda runtime, they just taking a
bootstrap
binary from us and that's it.So what I am suggesting instead, is to locate the core logic in the lib and have numerous binaries - two for now. The default bin will be binding to a socket, while the
--bin lambda
will produce a lambda-layered app ready for AWS Lambda runtime. This has a benefit of only including the code we need to the default binary and not adding lambda runtime specific stuff.We will still need logic for parsing command line args for the default binary (to accomplish the testing aspect of #202), but I think we could address it in a dedicated PR.
P.S.: I am suggesting to put auxiliary functions to the
utils
module