How does the sensor cache works?

Hi everyone !
So, I’m currently working on a private project with a Typescript/Javascript codebase. The project repository is hosted on Github and uses Github actions for the CI.
We have a corresponding project on Sonarcloud and in the CI workflow we’re using the NPM sonar scanner module to launch the scanner “locally” on the runner as recommended here.

We’re experiencing relatively long and slow analysis issues, like ~1800 analyzed files in the project in about 20-25 min. I don’t know if it seems long, but it sure feels long when you’re waiting for a result before merging the PR :slight_smile:

So I dug a little further by tweaking the properties and I found this “sensor cache” feature and wondered if we could indeed cache previous analysis results…but this does not seem to change anything.
I do see sensor cache created in the log, but all files are still re-analyzed everytime. So I wonder…what’s the purpose of this cache ? How does it work ?

I see in the debug logs lines like these:
Cache strategy set to 'WRITE_ONLY' for file '<path_to_my_file>' as current analysis requires all files to be analyzed everytime.

What are we missing ?

Thanks in advance !


Welcome to the community!

I think you’re hitting a known issue, the fix for which should be released soon.

In the meantime, this should help:


Hi Ann! thanks for your reply.
We already use the tsconfig property yes, I made a specific sonar tsconfig for all the files in the monorepo to speed things up a bit, but yes, I think we’re impatient for a fix or an improvement on this side :slight_smile:

1 Like