Skip to content

Commit

Permalink
#1906 more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Feb 28, 2024
1 parent 37c858b commit 97d3392
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/rultor/agents/aws/PrunesInstances.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
import com.rultor.spi.SuperAgent;
import com.rultor.spi.Talks;
import java.io.IOException;
import java.util.Collection;
import java.util.Date;
import java.util.LinkedList;
import java.util.concurrent.TimeUnit;
import lombok.ToString;

Expand Down Expand Up @@ -73,8 +75,10 @@ public void execute(final Talks talks) throws IOException {
.withFilters(new Filter().withName("rultor-talk"))
);
final long threshold = new Date().getTime() - TimeUnit.HOURS.toMillis(6L);
final Collection<String> seen = new LinkedList<>();
for (final Reservation rsrv : res.getReservations()) {
final Instance instance = rsrv.getInstances().get(0);
seen.add(instance.getInstanceId());
final Date time = instance.getLaunchTime();
if (time.getTime() > threshold) {
continue;
Expand All @@ -88,6 +92,10 @@ public void execute(final Talks talks) throws IOException {
instance.getInstanceId()
);
}
Logger.info(
this, "Checked %d AWS instances: %[list]s",
seen.size(), seen
);
}

}

0 comments on commit 97d3392

Please sign in to comment.