Skip to content

Commit

Permalink
missing tokens gives false positive end of content
Browse files Browse the repository at this point in the history
  • Loading branch information
ssalinas committed Jan 10, 2017
1 parent 6545a4a commit b7d4f2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public SingularityPaginatedResponse<SingularityTaskIdHistory> getTaskHistoryWith
@Path("/request/{requestId}/tasks")
@ApiOperation("Retrieve the history sorted by startedAt for all inactive tasks of a specific request.")
public List<SingularityTaskIdHistory> getTaskHistoryForRequest(
@ApiParam("Request ID to match") @PathParam("requestId") String requestId,
@ApiParam("Request ID to match") @PathParam("resquestId") String requestId,
@ApiParam("Optional deploy ID to match") @QueryParam("deployId") Optional<String> deployId,
@ApiParam("Optional runId to match") @QueryParam("runId") Optional<String> runId,
@ApiParam("Optional host to match") @QueryParam("host") Optional<String> host,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,10 @@ private List<SingularityS3LogMetadata> getS3LogsWithExecutorService(S3Configurat
public List<S3ObjectSummaryHolder> call() throws Exception {
ListObjectsV2Request request = new ListObjectsV2Request().withBucketName(s3Bucket).withPrefix(s3Prefix);
if (paginated) {
Optional<ContinuationToken> token = Optional.absent();
if (search.getContinuationTokens().containsKey(key) && !Strings.isNullOrEmpty(search.getContinuationTokens().get(key).getValue())) {
request.setContinuationToken(search.getContinuationTokens().get(key).getValue());
token = Optional.of(search.getContinuationTokens().get(key));
}
int targetResultCount = search.getMaxPerPage().or(DEFAULT_TARGET_MAX_RESULTS);
request.setMaxKeys(targetResultCount);
Expand All @@ -328,19 +330,21 @@ public List<S3ObjectSummaryHolder> call() throws Exception {
continuationTokens.putIfAbsent(key, new ContinuationToken(result.getNextContinuationToken(), true));
return Collections.emptyList();
} else {
if (incrementIfLessThan(resultCount, result.getObjectSummaries().size(), targetResultCount)) {
boolean addToList = incrementIfLessThan(resultCount, result.getObjectSummaries().size(), targetResultCount);
if (addToList) {
continuationTokens.putIfAbsent(key, new ContinuationToken(result.getNextContinuationToken(), !result.isTruncated()));
List<S3ObjectSummaryHolder> objectSummaryHolders = new ArrayList<>();
for (S3ObjectSummary objectSummary : result.getObjectSummaries()) {
objectSummaryHolders.add(new S3ObjectSummaryHolder(group, objectSummary));
}
return objectSummaryHolders;
} else {
continuationTokens.putIfAbsent(key, new ContinuationToken(null, false));
continuationTokens.putIfAbsent(key, token.or(new ContinuationToken(null, false)));
return Collections.emptyList();
}
}
} else {
continuationTokens.putIfAbsent(key, token.or(new ContinuationToken(null, false)));
return Collections.emptyList();
}
} else {
Expand Down

0 comments on commit b7d4f2e

Please sign in to comment.