Skip to content

Commit

Permalink
Merge pull request #1594 from szyn/v0_11_to_master-pr-1593
Browse files Browse the repository at this point in the history
[V0_11_To_Master] Fix ECS task log lost issue
  • Loading branch information
szyn authored Jun 4, 2021
2 parents 8ec0b46 + 7ebe068 commit d60a7a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

public class EcsCommandExecutor
Expand Down Expand Up @@ -329,6 +330,14 @@ CommandStatus createNextCommandStatus(
if (previousExecutorStatus.get("logging_finished_at") != null) {
break;
}
try {
// Just to avoid DOS attack to ECS endpoint
TimeUnit.SECONDS.sleep(2);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
}
while (Instant.now().getEpochSecond() < timeout);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ public GetLogEventsResult getLog(
final Optional<String> nextToken)
{
final GetLogEventsRequest request = new GetLogEventsRequest()
// This should be true when using `nextToken`. See the doc for details.
.withStartFromHead(true)
.withLogGroupName(groupName)
.withLogStreamName(streamName);
if (nextToken.isPresent()) {
Expand Down

0 comments on commit d60a7a8

Please sign in to comment.