Skip to content

Conversation

@Ziedelth
Copy link
Contributor

@Ziedelth Ziedelth commented Jan 4, 2026

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Ziedelth, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the episode update mechanism by replacing a single, generic update delay with a more sophisticated system that applies different delays based on an anime's seasonal relevance. This allows for more frequent updates for current season anime and less frequent updates for older content, optimizing resource usage and data freshness.

Highlights

  • Granular Episode Update Delays: Introduced new configuration properties (update_episode_delay_current_season, update_episode_delay_last_season, update_episode_delay_others) to allow for different episode update delays based on an anime's simulcast season status.
  • Database Changelog: Added a new Liquibase changelog (2026/01/01-changelog.xml) to manage the migration of these new configuration properties, including inserting default values and removing the old update_episode_delay property.
  • Refactored Episode Update Logic: The UpdateEpisodeMappingJob, EpisodeMappingService, and EpisodeMappingRepository have been refactored to utilize the new granular delay properties when determining which episodes need to be updated, improving the efficiency and relevance of updates.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the episode update logic to use more granular delay properties based on whether an episode belongs to the current, last, or other seasons. This is a good improvement for controlling the update frequency. The changes include updating the ConfigPropertyKey enum, refactoring the UpdateEpisodeMappingJob and EpisodeMappingService, and implementing the new query logic in EpisodeMappingRepository. A Liquibase changelog is added to migrate the database configuration.

I've provided a few suggestions to improve performance and maintainability:

  • In EpisodeMappingRepository, I've suggested using NOT EXISTS instead of NOT IN for better query performance.
  • In UpdateEpisodeMappingJob, I've pointed out a small inefficiency where a value is recalculated inside a loop.
  • For the Liquibase changelog, I've recommended combining the related database changes into a single atomic changeset.

Overall, the changes are well-structured and address the intended goal effectively.


needUpdateEpisodes.forEach { mapping ->
updateEpisodeMapping(mapping, identifiers, allPreviousAndNext, lastImageUpdateDateTime, zonedDateTime, needRecalculate, needRefreshCache)
updateEpisodeMapping(mapping, identifiers, allPreviousAndNext, zonedDateTime.minusDays(configCacheService.getValueAsInt(ConfigPropertyKey.UPDATE_IMAGE_EPISODE_DELAY, 2).toLong()), zonedDateTime, needRecalculate, needRefreshCache)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The value for lastImageUpdateDateTime is being recalculated on every iteration of the loop. While configCacheService is a cache, it's more efficient and cleaner to calculate this value once before the loop begins and store it in a variable.

Comment on lines 108 to 113
cb.not(animeJoin[Anime_.uuid].`in`(query.subquery(UUID::class.java).apply {
val subRoot = from(Anime::class.java)
select(subRoot[Anime_.uuid])
.where(subRoot.join(Anime_.simulcasts)[Simulcast_.uuid]
.`in`(listOfNotNull(currentSimulcastUuid, lastSimulcastUuid)))
})),
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For better performance, it's recommended to use NOT EXISTS with a correlated subquery instead of NOT IN. NOT IN can be inefficient, especially with large subquery result sets, and can have surprising behavior with NULL values. NOT EXISTS is often optimized better by database engines.

cb.not(cb.exists(query.subquery(Int::class.java).apply {
    val subRoot = from(Anime::class.java)
    select(cb.literal(1))
    where(
        cb.equal(subRoot[Anime_.uuid], animeJoin[Anime_.uuid]),
        subRoot.join(Anime_.simulcasts)[Simulcast_.uuid]
            .`in`(listOfNotNull(currentSimulcastUuid, lastSimulcastUuid))
    )
}))

@Ziedelth Ziedelth force-pushed the update-episode-by-simulcast branch from 8993f85 to bd0bb75 Compare January 4, 2026 15:19
@Ziedelth Ziedelth force-pushed the update-episode-by-simulcast branch from bd0bb75 to ae0d652 Compare January 4, 2026 16:28
@Ziedelth Ziedelth merged commit 9f58032 into master Jan 4, 2026
8 of 15 checks passed
@Ziedelth Ziedelth deleted the update-episode-by-simulcast branch January 4, 2026 17:28
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.

2 participants