forked from aws/aws-lambda-runtime-interface-emulator
-
Notifications
You must be signed in to change notification settings - Fork 2
Compatibility w/ AWS Fargate #1
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
w3ichen
wants to merge
31
commits into
develop
Choose a base branch
from
msc-v1.13
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
b57d8f4
Merge pull request #53 from aws/develop
valerena 49c35f6
v1.3 release
valerena 43a7a09
Merge changes for v1.8 release
valerena 5a79e1e
Merge changes for v1.9 release
valerena 9de974f
Merge changes for v1.11 release
valerena 23f8171
Merge changes for v1.12 release
valerena 04389ef
fix cors error
w3ichen b77ed50
upload bin/
w3ichen 09c6ee6
add AWS_LAMBDA_SERVER_MAX_INVOCATIONS
w3ichen e12199d
grace period before server shutdown
w3ichen 1fb9aec
wait for request to finish before shutdown
w3ichen 0bc0798
fixing done channel
w3ichen 6463ccb
change shutdown
w3ichen 21939ab
Added forward-response header
w3ichen eefe267
ADD API_ACCESS_KEY
w3ichen 0850a09
Create lambda-entrypoint.sh (copied from docker image)
w3ichen d58347f
Update lambda-entrypoint.sh with api_access_key.env file
w3ichen f51d540
Update lambda-entrypoint.sh
w3ichen 9968f96
Update lambda-entrypoint.sh
w3ichen 9bf5ab5
rm api_access_key
w3ichen aad4d03
Update lambda-entrypoint.sh
w3ichen 21fb963
Create lambda-entrypoint.original.sh
w3ichen b1f7acf
Run lambda-entrypoint.sh as user
w3ichen 680dd42
Update lambda-entrypoint.sh
w3ichen 8b28927
remove lambda-entrypoint
w3ichen 7617a6b
fix seg fault error binaries
w3ichen a1f0f8c
fix seg fault error binaries
w3ichen 84fbc7a
Update README.md
w3ichen d6d2060
new binaries with patches
w3ichen 1b6af0a
re-upload binaries compiled for linux
w3ichen d907de5
re-upload binaries compiled for linux
w3ichen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
change shutdown
- Loading branch information
commit 6463ccb19750a2c3de8db82718da4d93f035a107
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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 |
---|---|---|
|
@@ -5,7 +5,6 @@ package main | |
|
||
import ( | ||
"os" | ||
"time" | ||
"strconv" | ||
"net/http" | ||
|
||
|
@@ -35,24 +34,20 @@ func startHTTPServer(ipport string, sandbox *rapidcore.SandboxBuilder, bs intero | |
|
||
// Pass a channel | ||
http.HandleFunc("/2015-03-31/functions/function/invocations", func(w http.ResponseWriter, r *http.Request) { | ||
done := make(chan struct{}) // Channel to signal when the response has terminated | ||
|
||
InvokeHandler(w, r, sandbox.LambdaInvokeAPI(), bs, done) | ||
|
||
// Shutdown the server if we've reached the maximum number of invocations | ||
maxInvocations-- | ||
if maxInvocations == 0 { | ||
<-done // Wait until the response has terminated | ||
close(shutdownChan) | ||
} | ||
InvokeHandler(w, r, sandbox.LambdaInvokeAPI(), bs, func(){ | ||
// Shutdown the server if the maximum number of invocations is reached | ||
maxInvocations-- | ||
if maxInvocations == 0 { | ||
close(shutdownChan) | ||
} | ||
Comment on lines
+84
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Decrement the maxInvocations, if ==0, then shut down the server |
||
}) | ||
}) | ||
|
||
|
||
// go routine to handle server shutdown (main thread waits) | ||
go func() { | ||
<-shutdownChan | ||
log.Printf("Maximum invocations (%s) reached. Shutting down the server.", maxInvocationsStr) | ||
time.Sleep(60 * time.Second) // Grace period for client to receive the response | ||
if err := srv.Shutdown(nil); err != nil { | ||
log.Panic(err) | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Binary built files