Skip to content

Conversation

@christolis
Copy link
Member

From a recent conversation:

[13:09]Zabuzard: while at it, ZonedDateTime should be replaced by Instant in that file
[13:10]Zabuzard: does someone want to tackle that quickly or else we need to make a github issue 🙂
[13:56]christolis: what makes this change worthwhile?
[14:01]Zabuzard: its just the wrong class for the job
[14:01]Zabuzard: there is no reason to use ZDT in this case
[14:01]Zabuzard: Instant is the correct class
[14:02]Zabuzard: shouldnt require any deeper changes in this case, just a quick replacement should work```

@christolis christolis requested a review from a team as a code owner December 29, 2025 12:13
tj-wazei
tj-wazei previously approved these changes Dec 29, 2025
Copy link
Contributor

@tj-wazei tj-wazei left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me.

ZonedDateTime savedDate =
getZonedDateTime(rssRecord.getLastDate(), dateFormatterPattern);
return Optional.of(savedDate);
return Optional.of(Instant.parse(rssRecord.getLastDate()));
Copy link
Member

Choose a reason for hiding this comment

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

this will throw java.time.format.DateTimeParseException, we should handle it instead of just silenty eating the exception. Something like

catch (DateTimeParseException ignored) {
        try {
            //TODO: Should be removed once we cycle through all stored ZDT string instances
            Instant parsed_instant = ZonedDateTime.parse(raw).toInstant();
            //INFO log here converted from raw -> instant
            // save parsed_instant to database so this doesnt trigger exception on next run
            return Optional.of(parsed_instant); //
        } catch (DateTimeParseException e) {
            return Optional.empty();
        }
    }
    

Copy link
Member

@ankitsmt211 ankitsmt211 left a comment

Choose a reason for hiding this comment

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

everything looks good but we should handle the outdated timestamps stored in DB

@tj-wazei tj-wazei self-requested a review January 6, 2026 18:39
@tj-wazei tj-wazei dismissed their stale review January 6, 2026 18:40

Dismissing until we figure out a way to migrate the existing data for this to work.

@ankitsmt211
Copy link
Member

there's only two ways to handle this atleast the ones i can think of

  • one would be the suggestions i made where we handle it direclty by catching those exceptions and updating old type in DB at the same time
  • secondly you could disable routine, run a script on server to safely bulk update timestamps to instant merge new code in and enable the routine again

second one has more moving pieces and requires more effort from someone with access to VPS, first one runs and handles things on the fly we can later remove the logic which handles thing on exception once we stop getting the INFO logs for
//INFO log here converted from raw -> instant

* @throws DateTimeParseException if the date cannot be parsed
*/
private static ZonedDateTime getZonedDateTime(@Nullable String date, String format)
private static Instant getInstantTimeFromFormat(@Nullable String date, String datePattern)
Copy link
Member

Choose a reason for hiding this comment

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

btw, having the need to rename this on a type-change indicates that the method name is flawed.

it should be renamed into getTimeFromFormat or more idiomatic parseTime.

Also note the inconsistency with the parameter names called date instead of time. To avoid confusion it should proibably be renamed into parseDateTime and String dateTime, String pattern`

Handle rewriting timestamps from the specific RSS feed's format to a
more unified Instant string format.

If a DateTimeParseException is thrown while attempting to work with the
date format, use that opportunity to attempt to parse that original date
with the given date format pattern, then convert it into a string using
'Instant#toString'.

If the conversion fails, simply return an empty Optional and let the
rest of the code handle it from there since the new value will be
overwritten in any case.

Signed-off-by: Chris Sdogkos <[email protected]>
@christolis
Copy link
Member Author

@ankitsmt211 After some testing with the recently pushed changes, I was able to successfully handle outdated date-time strings in the database. No Flyway magic or offline scripts on the VPS needed. A review will be appreciated.

@ankitsmt211
Copy link
Member

Here's more context on the discussion around this PR https://discord.com/channels/272761734820003841/895717328359153664/1459639871726420020

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.

4 participants