Skip to content
This repository has been archived by the owner on Aug 17, 2020. It is now read-only.

Commit

Permalink
Merge pull request #144 from cwaltken-edrans/fix_timeout
Browse files Browse the repository at this point in the history
Fix continuous execution of lambda functions
  • Loading branch information
zeph authored Jul 17, 2017
2 parents 600a708 + a76312e commit 2618332
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 28 deletions.
4 changes: 2 additions & 2 deletions infrastructure/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (infra *AwsInfrastructure) invokeLambda(args interface{}) {
svc := lambda.New(session.New(), infra.config)

svc.InvokeAsync(&lambda.InvokeAsyncInput{
FunctionName: aws.String("goad:" + version.LambdaVersion()),
FunctionName: aws.String("goad"),
InvokeArgs: toJSONReadSeeker(args),
})
}
Expand Down Expand Up @@ -245,7 +245,7 @@ func (infra *AwsInfrastructure) createIAMLambdaRolePolicy(roleName string) error
"lambda:Invoke*"
],
"Resource": [
"arn:aws:lambda:*:*:goad:*"
"arn:aws:lambda:*:*:function:goad"
]
},
{
Expand Down
41 changes: 15 additions & 26 deletions lambda/lambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ func (l *goadLambda) forkNewLambda() {
j, _ := json.Marshal(args)

output, err := svc.InvokeAsync(&lambda.InvokeAsyncInput{
FunctionName: aws.String("goad:" + version.LambdaVersion()),
FunctionName: aws.String("goad"),
InvokeArgs: bytes.NewReader(j),
})
fmt.Println(output)
Expand All @@ -563,31 +563,20 @@ func (l *goadLambda) getInvokeArgsForFork() invokeArgs {
settings := l.Settings
params := settings.RequestParameters
args.Flags = []string{
"-u",
fmt.Sprintf("%s", params.URL),
"-c",
fmt.Sprintf("%s", strconv.Itoa(settings.ConcurrencyCount)),
"-n",
fmt.Sprintf("%s", strconv.Itoa(settings.MaxRequestCount)),
"-p",
fmt.Sprintf("%s", strconv.Itoa(l.Settings.CompletedRequestCount)),
"-N",
fmt.Sprintf("%s", strconv.Itoa(settings.StresstestTimeout)),
"-s",
fmt.Sprintf("%s", settings.SqsURL),
"-q",
fmt.Sprintf("%s", settings.QueueRegion),
"-t",
fmt.Sprintf("%s", settings.ClientTimeout.String()),
"-f",
fmt.Sprintf("%s", settings.ReportingFrequency.String()),
"-r",
fmt.Sprintf("%s", settings.LambdaRegion),
"-m",
fmt.Sprintf("%s", params.RequestMethod),
"-b",
fmt.Sprintf("%s", params.RequestBody),
}
fmt.Sprintf("--concurrency=%s", strconv.Itoa(settings.ConcurrencyCount)),
fmt.Sprintf("--requests=%s", strconv.Itoa(settings.MaxRequestCount)),
fmt.Sprintf("--completed-count=%s", strconv.Itoa(l.Settings.CompletedRequestCount)),
fmt.Sprintf("--execution-time=%s", strconv.Itoa(settings.StresstestTimeout)),
fmt.Sprintf("--sqsurl=%s", settings.SqsURL),
fmt.Sprintf("--queue-region=%s", settings.QueueRegion),
fmt.Sprintf("--client-timeout=%s", settings.ClientTimeout),
fmt.Sprintf("--frequency=%s", settings.ReportingFrequency),
fmt.Sprintf("--aws-region=%s", settings.LambdaRegion),
fmt.Sprintf("--method=%s", settings.RequestParameters.RequestMethod),
fmt.Sprintf("--body=%s", settings.RequestParameters.RequestBody),
}
args.Flags = append(args.Flags, fmt.Sprintf("%s", params.URL))
fmt.Println(args.Flags)
return args
}

Expand Down

0 comments on commit 2618332

Please sign in to comment.