Skip to content

Commit 34969de

Browse files
set server timeout instead of invoke deadline
1 parent ecab55f commit 34969de

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

cmd/localstack/custom_interop.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ func NewCustomInteropServer(lsOpts *LsOpts, delegate rapidcore.InteropServer, lo
6868
RuntimeId: lsOpts.RuntimeId,
6969
},
7070
}
71+
invokeTimeoutEnv := GetEnvOrDie("AWS_LAMBDA_FUNCTION_TIMEOUT")
72+
invokeTimeoutSeconds, err := strconv.Atoi(invokeTimeoutEnv)
73+
if err != nil {
74+
log.Fatalln(err)
75+
}
76+
invokeTimeout := time.Second * time.Duration(invokeTimeoutSeconds)
77+
server.delegate.SetInvokeTimeout(invokeTimeout)
7178

7279
// TODO: extract this
7380
go func() {
@@ -88,12 +95,6 @@ func NewCustomInteropServer(lsOpts *LsOpts, delegate rapidcore.InteropServer, lo
8895
}
8996

9097
invokeResp := &standalone.ResponseWriterProxy{}
91-
invokeTimeoutEnv := GetEnvOrDie("AWS_LAMBDA_FUNCTION_TIMEOUT")
92-
invokeTimeoutSeconds, err := strconv.Atoi(invokeTimeoutEnv)
93-
if err != nil {
94-
log.Fatalln(err)
95-
}
96-
invokeTimeout := time.Second * time.Duration(invokeTimeoutSeconds)
9798
functionVersion := GetEnvOrDie("AWS_LAMBDA_FUNCTION_VERSION") // default $LATEST
9899
_, _ = fmt.Fprintf(logCollector, "START RequestId: %s Version: %s\n", invokeR.InvokeId, functionVersion)
99100

@@ -106,7 +107,7 @@ func NewCustomInteropServer(lsOpts *LsOpts, delegate rapidcore.InteropServer, lo
106107
CorrelationID: "invokeCorrelationID",
107108
NeedDebugLogs: true,
108109
InvokedFunctionArn: invokeR.InvokedFunctionArn,
109-
DeadlineNs: strconv.FormatInt(invokeTimeout.Nanoseconds(), 10),
110+
//DeadlineNs:
110111
})
111112
if err != nil {
112113
log.Fatalln(err)

0 commit comments

Comments
 (0)