Conversation
# Conflicts: # src/Geta.Optimizely.Sitemaps/Geta.Optimizely.Sitemaps.Views/Views/Shared/_ShellLayout.cshtml
Ensure the cache expiration time for sitemap data is always non-negative by applying a Math.Max check. This prevents potential errors caused by invalid configuration values.
Replaced `SitemapDataCacheExpirationInMinutes` with more specific `RealtimeCacheExpirationInMinutes` and `RealtimeCacheExpirationInMinutesGoogleBot`. Updated caching logic to use the new properties and revised README to reflect the changes in configuration.
The EnableLanguageDropDownInAdmin configuration property has been removed from the README and SitemapOptions class as it is no longer used. This simplifies the codebase and enhances maintainability by removing unnecessary fields.
There was a problem hiding this comment.
Summary of Changes
Hello @kaspars-ozols, 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 introduces new configuration options for sitemap caching, allowing for distinct cache expiration times for general requests and GoogleBot requests. It also removes an obsolete configuration setting and includes a minor bug fix related to URL processing, specifically enhancing the robustness of URL handling in the sitemap generation process.
Highlights
- Sitemap Cache Configuration: Introduced RealtimeCacheExpirationInMinutes and RealtimeCacheExpirationInMinutesGoogleBot to allow granular control over sitemap cache durations.
- Obsolete Setting Removal: The EnableLanguageDropDownInAdmin configuration option has been removed from the sitemap settings.
- URL Utility Bug Fix: A potential IndexOutOfRangeException in the UrlFilter utility has been addressed by adding a null or whitespace check before processing URLs for trailing slashes.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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
-
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. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces several small fixes and adjustments. It removes the EnableLanguageDropDownInAdmin option and adds new configuration for realtime sitemap cache expiration for regular users and Google Bot. The documentation in README.md is updated accordingly. A bug that could cause an exception when processing an empty URL in UrlFilter has been fixed. My review focuses on the updated caching logic in GetaSitemapController, where I've identified a potential issue with cache invalidation that could lead to serving stale sitemaps.
src/Geta.Optimizely.Sitemaps/Controllers/GetaSitemapController.cs
Outdated
Show resolved
Hide resolved
Replaced manual character checks with `string.EndsWith` and `string.StartsWith` for better readability and cleaner code. This improves maintainability and ensures consistency in URL manipulation logic.
Refactored the `SitemapCreateJob` to use a results tracking mechanism for individual sitemap generation and introduced error handling. Improved code readability, replaced string formatting with interpolation, and ensured clear logging of success or failure for each sitemap. Exceptions are now thrown if any generation process fails, providing more robust error reporting.
Added the content version key to the cache eviction policy to ensure cache invalidation occurs when content updates. This improves the accuracy of the sitemap data served to users.
Eliminated separate caching behavior for Googlebot by removing related code, configurations, and logic. The caching mechanism now uses a unified expiration setting for all users, improving simplicity and maintainability. The cache will be automatically invalidated in case any content gets published.
This change removes an extra blank line in the SitemapOptions configuration class to maintain consistent formatting and improve code readability. No functional changes were made.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a number of small fixes and improvements. A key change is the removal of special caching logic for Google Bot in favor of a configurable absolute cache expiration for real-time sitemaps. This is a breaking change as it removes the EnableLanguageDropDownInAdmin option and introduces RealtimeCacheExpirationInMinutes. The scheduled job for sitemap generation has been improved to correctly report failures. The documentation has been updated to reflect these changes, although one example could be improved to better showcase the new functionality. Other changes include minor code style and readability improvements.
Updated the JSON example in the README to include the new `RealtimeCacheExpirationInMinutes` parameter. This provides better guidance on configuring cache expiration for real-time sitemaps.
|
|
This PR is strongly inspired by #135 However, with some slight adjustments: #104 - was fixed by adding EndsWith (otherwise tailing slash would not be added in case of empty string and that would not match the method name). |



No description provided.