Closed someniatko closed 1 year ago
Hey @someniatko,
I added spl_autoload_register($this->getConfiguration()->getProxyAutoloader()) to ProxyFactory::createProxyClassWithAdapter() as a proof of concept, and proxies stopped being regenerated each time. And it worked with the readonly cache dir (I want to have fully immutable project dir).
The autoloader is done in MessagingSystemConfiguration now. Can you provide PR that will move it to ProxyFactory and for checking writing only in case we dump the config?
I remember about PRs I have agreed to do in the earlier discussions BTW :D
Let's keep the configuration name as it's :)
As I forgot in new Ecotone version, the custom Symfony configuration will be dropped in favour of ServiceContext
configuration.
I will do a PR soon
Ecotone version(s) affected: 1.108.1
Description
Continuation of https://github.com/ecotoneframework/ecotone-dev/issues/217
Now
cache:warmup
Symfony command properly generates proxy classes in<cache-dir>/ecotone
, however they are still generated on fly.How to reproduce
<cache-dir>/ecotone
readonlyAssert::isTrue(is_writable($cacheDirectoryPath), ...)
inMessagingSystemConfiguration
. By the way, this check prevents me from having a readonly cache dir, which I would like to have after I dumped all proxies via cache:warmup. Dunno what to do about it, I suggest just removing it altogether - if the cache dir is not writable at the moment of writing a proxy class, it will tell you anyway.php bin/console list
orphp bin/console ecotone:list
.You'll get an error
Cannot rename "/tmp/ProxyManagerGeneratedProxy__PM__EcotoneMessagingGatewayConsole...
.Possible Solution
See https://github.com/Ocramius/ProxyManager/blob/2.15.x/docs/tuning-for-production.md
Basically we have to register the proxy autoloader before attempting to use proxies. Otherwise they are regenerated each time as now.
I added
spl_autoload_register($this->getConfiguration()->getProxyAutoloader())
toProxyFactory::createProxyClassWithAdapter()
as a proof of concept, and proxies stopped being regenerated each time. And it worked with the readonly cache dir (I want to have fully immutable project dir).I remember about PRs I have agreed to do in the earlier discussions BTW :D