Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
thjarvin committed Apr 30, 2024
1 parent 93fb7cd commit 3bbc6db
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MetroJourneyResultSetProcessor extends AbstractResultSetProcessor {
Expand All @@ -26,6 +28,7 @@ public MetroJourneyResultSetProcessor(final RedisUtils redisUtils, final QueryUt
public void processResultSet(final ResultSet resultSet) throws Exception {
int rowCounter = 0;
int redisCounter = 0;
List<String> metroKeys = new ArrayList<>();

while (resultSet.next()) {
rowCounter++;
Expand All @@ -45,6 +48,7 @@ public void processResultSet(final ResultSet resultSet) throws Exception {
values.put(TransitdataProperties.KEY_START_STOP_NUMBER, stopNumber);

String metroKey = TransitdataProperties.formatMetroId(stopNumber, dateTime);
metroKeys.add(metroKey);
String response = redisUtils.setValues(metroKey, values);
if (redisUtils.checkResponse(response)) {
redisUtils.setExpire(metroKey);
Expand All @@ -55,6 +59,7 @@ public void processResultSet(final ResultSet resultSet) throws Exception {
}

log.info("Inserted {} redis metro id keys for {} DB rows", redisCounter, rowCounter);
log.info("Metro keys: " + metroKeys);
}

protected String getQuery() {
Expand Down

0 comments on commit 3bbc6db

Please sign in to comment.