FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add debug wait after invocation completes by dominikschubert · Pull Request #16 · localstack/lambda-runtime-init · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .go  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 9 additions & 0 deletions cmd/localstack/custom_interop.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"go.amzn.com/lambda/rapidcore/standalone"
"io"
"net/http"
"strconv"
"strings"
"time"
)
Expand Down Expand Up @@ -139,6 +140,14 @@ func NewCustomInteropServer(lsOpts *LsOpts, delegate rapidcore.InteropServer, lo
log.Fatalln(err)
}
}
// optional sleep. can be used for debugging purposes
if lsOpts.PostInvokeWaitMS != "" {
waitMS, err := strconv.Atoi(lsOpts.PostInvokeWaitMS)
if err != nil {
log.Fatalln(err)
}
time.Sleep(time.Duration(waitMS) * time.Millisecond)
}
timeoutDuration := time.Duration(timeout) * time.Second
memorySize := GetEnvOrDie("AWS_LAMBDA_FUNCTION_MEMORY_SIZE")
PrintEndReports(invokeR.InvokeId, "", memorySize, invokeStart, timeoutDuration, logCollector)
Expand Down
4 changes: 4 additions & 0 deletions cmd/localstack/main.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type LsOpts struct {
InitLogLevel string
EdgePort string
EnableXRayTelemetry string
PostInvokeWaitMS string
}

func GetEnvOrDie(env string) string {
Expand Down Expand Up @@ -54,6 +55,7 @@ func InitLsOpts() *LsOpts {
EnableDnsServer: os.Getenv("LOCALSTACK_ENABLE_DNS_SERVER"),
EnableXRayTelemetry: os.Getenv("LOCALSTACK_ENABLE_XRAY_TELEMETRY"),
LocalstackIP: os.Getenv("LOCALSTACK_HOSTNAME"),
PostInvokeWaitMS: os.Getenv("LOCALSTACK_POST_INVOKE_WAIT_MS"),
}
}

Expand All @@ -71,6 +73,8 @@ func UnsetLsEnvs() {
"LOCALSTACK_ENABLE_DNS_SERVER",
"LOCALSTACK_ENABLE_XRAY_TELEMETRY",
"LOCALSTACK_INIT_LOG_LEVEL",
"LOCALSTACK_POST_INVOKE_WAIT_MS",

// Docker container ID
"HOSTNAME",
// User
Expand Down

Back | FazBrowse Home | New Git URL