Skip to content
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

Simplify Lambda payload parsing #10210

Merged
merged 1 commit into from Feb 13, 2024
Merged

Simplify Lambda payload parsing #10210

merged 1 commit into from Feb 13, 2024

Conversation

joe4dev
Copy link
Member

@joe4dev joe4dev commented Feb 9, 2024

Motivation

The code for parsing the JSON payload of a Lambda invocation is unnecessarily cumbersome. It is also used heavily (>150 times across LS and ext). Making such a common task more readable improves maintainability and extensibility (more Lambda service integrations will likely reuse the same code patterns).

Changes

-        events = json.loads(to_str(invoke_result["Payload"].read()))
+        events = json.load(invoke_result["Payload"]))
  • Apply minor refactorings to unify usage (e.g., merge or split lines)

Copy link

github-actions bot commented Feb 9, 2024

S3 Image Test Results (AMD64 / ARM64)

  2 files    2 suites   3m 13s ⏱️
386 tests 336 ✅  50 💤 0 ❌
772 runs  672 ✅ 100 💤 0 ❌

Results for commit 026820c.

♻️ This comment has been updated with latest results.

@joe4dev joe4dev self-assigned this Feb 9, 2024
@joe4dev joe4dev added the semver: patch Non-breaking changes which can be included in patch releases label Feb 9, 2024
@coveralls
Copy link

coveralls commented Feb 9, 2024

Coverage Status

coverage: 83.828% (-0.002%) from 83.83%
when pulling 026820c on simplify-json-loading
into 04d92da on master.

Copy link

github-actions bot commented Feb 9, 2024

LocalStack Community integration with Pro

    2 files      2 suites   1h 21m 8s ⏱️
2 633 tests 2 386 ✅ 247 💤 0 ❌
2 635 runs  2 386 ✅ 249 💤 0 ❌

Results for commit 026820c.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@calvernaz calvernaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for tackling this 🚀

Copy link
Contributor

@macnev2013 macnev2013 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@joe4dev joe4dev merged commit 8aeabc1 into master Feb 13, 2024
33 checks passed
@joe4dev joe4dev deleted the simplify-json-loading branch February 13, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants