You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Name resultCache.php file more uniquely in global tmpDir #7379
Do not change anything if the project explicitly sets tmpDir. It usually means that the CI depends on %tmpDir%/resultCache.php to exist because they persist it across runs.
Otherwise (if the tmpDir is the default system one which means it's gonna be shared across all projects), append something like current working directory hash to %resultCachePath%. So it's not going to be /tmp/phpstan/resultCache.php, but something like /tmp/phpstan/resultCache-xyz.php where xyz is derived from CWD.
In my case, it should be a hash of a config file path, not just dir path. I'm using two .neon files in the same dir, they're each for a different part of the codebase, so they would share the same dir and the cache would be overwritten anyway.
we consider this issue a major problem for us, as we loose 2-3 minutes on every phpstan run, which leats to developers loosing focus.
I looked into fixing this problem and found that %resultCachePath% is a variable managed by the injection container.
do you have any hints on how this variable can/should be changed at runtime?
I am not very experienced with the nette* stuff I have to admin.
Use a custom and different tmpDir in each of your projects.
thats too much hassle, in a lot of files.
Or contribute the proposed fix here ;)
thats what I want to todo. could you help me with this:
I looked into fixing this problem and found that %resultCachePath% is a variable managed by the injection container.
do you have any hints on how this variable can/should be changed at runtime?
How to pass this information into ResultCacheManager. I think we could pass a simple boolean "isTmpDirDefault" and if it's true, we could deconstruct $this->cacheFilePath in ResultCacheManager and add some kind of hash there.
We should also think about people that don't change their tmpDir but change their resultCachePath. We should not change the path in that case.
@spaze in phpstan/phpstan-src#1469 I have built a patch which uses a different resultcache per md5-hash of configured analyzedPath and bootstrapFiles (as we don't know the config file path at this places).
Could you check this holds for your setup/use-case?
Activity
spaze commentedon Jun 2, 2022
Relevant comment from #7260 (comment):
In my case, it should be a hash of a config file path, not just dir path. I'm using two
.neonfiles in the same dir, they're each for a different part of the codebase, so they would share the same dir and the cache would be overwritten anyway.staabm commentedon Jun 23, 2022
we consider this issue a major problem for us, as we loose 2-3 minutes on every phpstan run, which leats to developers loosing focus.
I looked into fixing this problem and found that
%resultCachePath%is a variable managed by the injection container.do you have any hints on how this variable can/should be changed at runtime?
I am not very experienced with the nette* stuff I have to admin.
Thank you.
ondrejmirtes commentedon Jun 23, 2022
Use a custom and different
tmpDirin each of your projects. (Or contribute the proposed fix here ;))staabm commentedon Jun 23, 2022
thats too much hassle, in a lot of files.
thats what I want to todo. could you help me with this:
?
ondrejmirtes commentedon Jun 23, 2022
There are two challenges:
$this->cacheFilePathin ResultCacheManager and add some kind of hash there.We should also think about people that don't change their
tmpDirbut change theirresultCachePath. We should not change the path in that case.staabm commentedon Jun 30, 2022
@spaze in phpstan/phpstan-src#1469 I have built a patch which uses a different resultcache per md5-hash of configured
analyzedPathandbootstrapFiles(as we don't know the config file path at this places).Could you check this holds for your setup/use-case?
spaze commentedon Jun 30, 2022
Cool, seems it should be fine, that combo is unique in my cases (e.g.
paths1,paths2). Thanks!