Skip to content

chore(lambda-runtime): slightly optimize graceful shutdown helper by using new tokio::try_join biased; api #1007

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jlizen
Copy link
Contributor

@jlizen jlizen commented Jul 3, 2025

✍️ Description of changes:
Closing out some minor to-dos. My tokio PR adding a biased; mode to join/try_join landed. This allows us to skip the bookkeeping of keeping track of which branch of a join/try_join! statement was polled last, and always just poll in order.

This is a minor optimization for our graceful shutdown handler, since we always want to just poll our graceful shutdown future first before our non-op extension. So we can save a bit of memory on the stack by skipping storing a usize. It also very marginally could impact latency (by micros if not nanos, it's insignificant probably).

Also applying a similar optimization to the internal extension example where we have it the extension wait until after the main handler completes so that it can flush telemetry.

This involved explicitly setting tokio to 1.46. This won't impact our MSRV as our MSRV is set to 1.81 but tokio is 1.70.

🔏 By submitting this pull request

  • I confirm that I've ran cargo +nightly fmt.
  • I confirm that I've ran cargo clippy --fix.
  • I confirm that I've made a best effort attempt to update all relevant documentation.
  • I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jlizen
Copy link
Contributor Author

jlizen commented Jul 3, 2025

Clippy check is failing due to unlined format args changing to warn level.

But I have this fixed in: #1005

Probably fine to ignore in this CR in favor of that fix.

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.

1 participant