Cache.evict or client.refetchQueries slow

Hi,

I have a weird issue and I am hoping someone has an idea what could cause it.

In my project, whenever I call a mutation, I have a cache eviction procedure that is triggered.

In my case, when a mutation is called, I evict the cache using:

cache.evict({ id: "ROOT_QUERY", fieldName: "myQuery" });

For some reason, for listing queries, it seems to take up at least 1 to 2 seconds or more in some cases for the query to finish.

I even tried client.refetchQueries({ include: ["myQuery"] }) and its the same result.

What I find odd, is if I log off and log back into my project and execute the same queries normally, it takes less than 1 sec to complete.

So there seems to be a behavior in cache.evict or client.refetchQueries that seem slower than normal.

I was wondering if anyone has ever noticed or had this issue before?

UPDATE

What is weird about this issue, is that when I do the same test on my dev instance with the same DB that has the issue, the cache.evict’s result is fast under 200 ms, but on the production server it seems to be at min 2 secs.

I am using latest version of @apollo/client.

UPDATE 2

My tests so far were inconclusive, but for the heck of it I restarted my GraphQL production server.
And now the query is under 200 ms instead of 2 secs.
What is strange, is I executed the same queries in postman and I kept getting 200 ms.
Is there something in the configuration of @apollo/server that could delay or affect a response for a @apollo/client vs a postman call?

FINAL UPDATE

The issue was my cache eviction system. So it wasn’t related to refetchQueries or cache.evict.
It was in the GraphQL side.