-
Notifications
You must be signed in to change notification settings - Fork 38
Follow the next token when pages of results returned #37
Conversation
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.
Thanks! I'll fix up whatever is wrong with the CI pipeline to get a green build then merge.
Nice one, thanks @pda. We have another urgent fix at 99designs#1 |
Hmm… when I run the tests locally,
|
Nope… cherry-picking 73c315f onto this branch doesn't fix it. And |
|
Ah, so I think the pagination callback boolean was flipped in the implementation (which this PR fixed) and in the test (which wasn't fixed)? This gets the tests green: --- a/runner/cloudwatch_test.go
+++ b/runner/cloudwatch_test.go
@@ -188,7 +188,7 @@ func (cw *mockCloudWatchLogs) FilterLogEventsPages(input *cloudwatchlogs.FilterL
output.Events = append(output.Events, e)
}
- if fn(output, len(cw.filterLogEvents) == 0) {
+ if !fn(output, len(cw.filterLogEvents) == 0) {
cw.Unlock()
return nil
} I'm not sure it's the ideal solution. |
Green build was in https://buildkite.com/buildkite/ecs-run-task/builds/14 |
The AWS SDK Pages functions iterate over pages of results automatically using the NextToken returned from AWS API. However in order to allow the function to iterate correctly, you need to return
true
when NextToken exists - i.e. when the lastPage has not been reachedFrom the docs
This change corrects code using Pages functions when the lastPage has not been reached.