Skip to content

Conversation

@chihaiaalex
Copy link

No description provided.

int lookupCounter = 0;
int rowCounter = 0;
@Override
String getQuery() {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just moved above and removed the redundant string builder.

The order of methods definition follows the order of steps executed by the processor:
getting query
collecting results
processing them

resultSet.getString(queryUtils.START_TIME)));
}

log.info("[OPTIMIZED] Database query found {} rows", journeyResultItems.size());
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was moved to the main QueryProcessor, both the log line and closing the query

log.error("Unknown exception during query ", e);
log.info("All data processed");
} catch (SQLException e) {
throw new RuntimeException(e);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

propagating the error so the job execution would be marked as failed and retried.


public static void main(String[] args) {
String connectionString = "";
var jobId = randomUUID().toString();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we can correlate in the central logging system all the logs for a given run

import static fi.hsl.common.transitdata.TransitdataProperties.formatMetroId;
import static fi.hsl.transitdata.pubtransredisconnect.MetroJourneyResultSetProcessor.MetroJourneyResultItem;

public class MetroJourneyResultSetProcessor extends AbstractResultSetProcessor<MetroJourneyResultItem> {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migrating this processor to the same logic of:
executing query
collecting results
closing query
processing items

public class StopResultSetProcessor extends AbstractResultSetProcessor {
import static fi.hsl.transitdata.pubtransredisconnect.StopResultSetProcessor.StopResultItem;

public class StopResultSetProcessor extends AbstractResultSetProcessor<StopResultItem> {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migrating this processor to the same logic of:
executing query
collecting results
closing query
processing items

@haphut haphut self-requested a review October 9, 2025 08:52
Copy link
Contributor

@haphut haphut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! LGTM.

@chihaiaalex chihaiaalex merged commit 48edf92 into run-as-cronjob Oct 9, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants