Unstable cache behavior question
Unanswered
Gouty oak gall posted this in #help-forum
Gouty oak gallOP
I have a function that is defined as follows:
Most of the time this works fine and I see NO output of the info statement after the first call. However, periodically (2-3 a week) chaos kicks in and I see 100s of outputs of the info line (all near the same time) which causes major stress on the database as that call isn't meant to be called frequently. The function itself is called by a dynamic page that gets hit frequently but shouldn't the cache prevent multiple calls?
Any ideas?
export const getIngredientPairs = unstable_cache(async (): Promise<IngredientPair[]> => {
console.info("call to getIngredientPairs (should not happen often)");
//do crazy query
return results;
},null,{revalidate:false,tags:['getIngredientPairs']});Most of the time this works fine and I see NO output of the info statement after the first call. However, periodically (2-3 a week) chaos kicks in and I see 100s of outputs of the info line (all near the same time) which causes major stress on the database as that call isn't meant to be called frequently. The function itself is called by a dynamic page that gets hit frequently but shouldn't the cache prevent multiple calls?
Any ideas?