FriendsOfSymfony / FOSJsRoutingBundle

A pretty nice way to expose your Symfony routing to client applications.
1.48k stars 261 forks source link

Bypass cache for exposed routes in debug mode makes things very slow. Make it configurable? #389

Open timwsuqld opened 4 years ago

timwsuqld commented 4 years ago

We recently upgraded to the latest FOSJsRouting bundle and suddenly our page loads started hitting 13s per load when developing. Turns out dcfde60c5a4c2ed8ecaa29ef8bfc55b77fc995dc (#362) means that every page load now ignores the cache and so it has to generate a new routes file every page load.

I understand that while testing routing specifically you probably want this, but when you have lots of routes/controllers this makes debug mode useless.

My understanding of ConfigCache is that we should be able to get it to trigger a rebuild when routes have changed? This means we don't need the debug to invalidate the cache for every page load.

Alternatively, it would be good if you could set the debug parameter for the fosjsrouting bundle instead of just taking the kernel debug status (maybe take the kernel debug status as the default). This way we could have debug turned off when we know we don't need to refresh the js routes every page load.

Yes, I understand we can just dump the routes and load a static file, but when developing it makes more sense to load it from the controller and have ConfigCache invalidate the cache as required.