-
Notifications
You must be signed in to change notification settings - Fork 116
Propagate Connection Closed Information up to top-level (fix #465) #545
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
base: main
Are you sure you want to change the base?
Propagate Connection Closed Information up to top-level (fix #465) #545
Conversation
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 you'd be better to use the state machine to work out state, instead of adding additional variables, outside of the state machine.
Why don't you just check for the disconnected state in LambdaRuntimeClient.nextInvocation
and if it is set throw a LambdaRuntimeError(code: .connectionToControlPlaneLost)
@adam-fowler This was already implemented (not by me). But |
That doesn't work in this context because I need to propagate the error from a callback inside Throwing errors is not an option neither because the only place where I can trap the |
This PR implements a mechanism to propagate connection loss information from the Lambda runtime client to the runtime loop using
EventLoopFuture
, enabling termination without backtrace when the connection to the Lambda control plane (or a Mock Server) is lost.This PR fixes #465
Changes Made
Core Changes:
LambdaRuntimeClient
: AddedfutureConnectionClosed
property to signal connection loss viaEventLoopFuture
Lambda.swift
: ModifiedrunLoop
to monitor connection status and throw an error on connection lossLambdaRuntime
andServiceLifecycle
Integration: Modified to properly handle connection loss (and other top-level) errors and avoid application to crash with a backtrace.Termination without a backtrace
Use Cases