Skip to content
This repository was archived by the owner on Mar 10, 2023. It is now read-only.

Commit 929280a

Browse files
Martin Dekov (VMware)alexellis
authored andcommitted
Call garbage-collect through async route
Calling garbage-collect through async route in github-event so the request wont time out in case we have couple of functions deployed Signed-off-by: Martin Dekov (VMware) <mdekov@vmware.com>
1 parent 39293c6 commit 929280a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

github-event/handler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func garbageCollect(garbageRequests []GarbageRequest) error {
156156

157157
body, _ := json.Marshal(garbageRequest)
158158
bodyReader := bytes.NewReader(body)
159-
req, _ := http.NewRequest(http.MethodPost, gatewayURL+"function/garbage-collect", bodyReader)
159+
req, _ := http.NewRequest(http.MethodPost, gatewayURL+"async-function/garbage-collect", bodyReader)
160160

161161
digest := hmac.Sign(body, []byte(payloadSecret))
162162
req.Header.Add(sdk.CloudSignatureHeader, "sha1="+hex.EncodeToString(digest))
@@ -168,7 +168,8 @@ func garbageCollect(garbageRequests []GarbageRequest) error {
168168
if res.Body != nil {
169169
defer res.Body.Close()
170170
}
171-
if res.StatusCode != http.StatusOK {
171+
if res.StatusCode != http.StatusAccepted {
172+
log.Printf("Unexpected status code for function: `%s` - %d\n", garbageRequest.Repo, res.StatusCode)
172173
resBody, _ := ioutil.ReadAll(res.Body)
173174
fmt.Printf("Error in garbageCollect: %s\n", resBody)
174175
}

0 commit comments

Comments
 (0)