Skip to content

Reduced caching#64

Merged
MarvelNwachukwu merged 4 commits intomainfrom
reduced-caching
Jan 21, 2026
Merged

Reduced caching#64
MarvelNwachukwu merged 4 commits intomainfrom
reduced-caching

Conversation

@MarvelNwachukwu
Copy link
Copy Markdown
Contributor

@MarvelNwachukwu MarvelNwachukwu commented Jan 20, 2026

Changes made:

  • Reduced cache duration from 24hrs to 5 minutes
  • Removed unstable cache, rely on hitting gateway and gateway revalidating every 5 minutes

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jan 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
braindao-ui Ready Ready Preview Jan 21, 2026 9:47pm

Request Review

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @MarvelNwachukwu, 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 focuses on enhancing data freshness by adjusting the caching strategy for market statistics. It removes a Next.js unstable_cache implementation and drastically shortens the cache duration for external API calls, ensuring that displayed information is more current. Additionally, a minor update to the Husky pre-push hook addresses a deprecated configuration.

Highlights

  • Caching Strategy Update: The unstable_cache wrapper has been removed from the getIqStats function, and the cache duration for market data fetches has been significantly reduced from 24 hours to 5 minutes.
  • Husky Configuration Adjustment: A deprecated line related to Husky script sourcing has been commented out in the .husky/pre-push hook, with a note indicating it should be permanently removed.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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
Copy Markdown
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 aims to reduce caching by refactoring getIqStats and decreasing the cacheDuration for fetchMarketCapData. However, a critical security vulnerability was identified: the fetchMarketCapData function exposes an API key to the client-side because it's loaded from a NEXT_PUBLIC_ environment variable. This allows any user to steal and abuse the key. It is crucial to move this key to a private, server-side only environment variable.

Comment thread .husky/pre-push
@@ -1,5 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
# . "$(dirname "$0")/_/husky.sh" // Depreciated in husky v10, TODO: Remove this permanently
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The comment uses a mix of shell (#) and C-style (//) comment syntax. Additionally, if this line is truly deprecated and needs to be removed permanently as indicated by the TODO, it would be cleaner to remove it now rather than commenting it out. This avoids keeping dead code in the repository.

Comment thread src/app/[locale]/_actions.ts Outdated
params: {
url: "https://pro-api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=everipedia",
cacheDuration: CACHE_DURATION_SECONDS_24_HR_IN_SECONDS,
cacheDuration: CACHE_DURATION_SECONDS_5_MIN_IN_SECONDS,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yessir, they're both 5 minutes cache duration now

@Adebesin-Cell
Copy link
Copy Markdown
Member

Just to clarify, is 5 mins the agreed duration for cache?

Comment thread src/app/[locale]/_actions.ts Outdated
} from "./_schema";

const CACHE_DURATION_SECONDS_24_HR_IN_SECONDS = 24 * 60 * 60;
const CACHE_DURATION_SECONDS_5_MIN_IN_SECONDS = 5 * 60;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

5 mins cache duration ? Are you sure about that ?
We run a risk of maxing out the credits faster with this change, giving the fact that we are using the api across several projects.
It's important you confirm before going ahead with this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, that's why I ask for both your review before going ahead with this. The agent trading platform requests IQ price, eth and frax I believe with a cache duration of 1 minute 😅

In theory, this would always hit cached prices from IQ, no? @Adebesin-Cell

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We also use 5 minutes for the IQAI landing

I see IQWiki uses 12 hrs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's true. I think we should take a moment before merging. Let's test and observe the outcomes first. We can set up a dummy API that sends some data, and we can monitor the cache. This way, we can replicate our situation and evaluate the trade-offs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If it takes too much time, like Kesar said:

if it takes too long dont need to overcomplicate stuff. figure out the one that has the longest cache and try to set similar one. its fine if 2 sites in our list of website has a slighly different number. probably bother nobody but us

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Longest cache is this landing page, 24hrs...We could set all landing pages to 12 hrs like wiki. 24 is alot with how price moves these days

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds good 👍. @Damola18 wdy think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, check the ext-api and see if there's a key with caching.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds good 👍. @Damola18 wdy think?

Yeah, we can do that. We can change to 6 hours after monitoring over the next few days.

@MarvelNwachukwu MarvelNwachukwu merged commit c07f2f6 into main Jan 21, 2026
2 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