Skip to content

Commit c793719

Browse files
Close client at the end of the function scope
Failing to do so can produce `too many open files` when used many times per process.
1 parent a7fb43c commit c793719

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

golambdainvoke/invoke.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ func Run(input Input) ([]byte, error) {
3535
return nil, err
3636
}
3737

38+
defer client.Close()
39+
3840
// 3. Issue an RPC request for the Function.Invoke method
3941
var response messages.InvokeResponse
4042

4143
if err = client.Call(functioninvokeRPC, request, &response); err != nil {
4244
return nil, err
4345
}
44-
46+
4547
if response.Error != nil {
4648
return nil, errors.New(response.Error.Message)
4749
}

0 commit comments

Comments
 (0)