You can clone with
I have noticed something while using Padrino (currently I am using 0.10.5).
First of all, it a bit long to start, and this is not such a problem. I (re)start very seldom. But the problem comes when I change a helper file or controller file. In this case I am waiting between 30 seconds to 2 minutes sometimes for the app to reload.
What makes this even stranger, is that when I do not change a file that is directly tied to the framework, such as the models, or the views (mine are datamapper and haml respectively), then I am only waiting for maybe 5 seconds for the reload to happen.
As you can imagine, 30 seconds here, and 1 minute there, soon adds up and I think I have easily spent a couple of hours in a few weeks just waiting for padrino to reload.
Is there anything that I could check that could be causing it to take so long to do the reloads? I have checked the logs, and even started padrino with strace, but I wasn't able to see what was causing the slowness.
@DAddYE any ideas on this?
Yep, I will check and try to fix it for next coming release.
@philly-mac which orm? How many models? Controllers? Helpers?
Thanks so much!
ORM: Datamapper (although it was the same with sequel, and mongoid)
+1 I'm having the same problem. It works fine with models but changing a controller makes it reload all models (or Sequel is at least doing new SQL-queries to check the database structure).
I'm hoping for a fix soon :)
can you guys test the reloader branch of https://github.com/dcu/padrino-framework.git and report back?
it's not a direct fix for this issue but it can help I think.
gem 'padrino', :git => "https://github.com/dcu/padrino-framework.git", :branch => "reloader"
to your Gemfile
Yes @philly-mac @PatrickLef and others, please try that branch and let us know if it helps address the issue. We will prioritize this into the next release if it makes an improvement. Thanks @dcu for putting this together.
It is actually hard for me to do that at the moment. What I was/am working on is time critical, so I had to change over to using sinatra and just using the padrino helpers and log, which seems to have the desired effect. I do have the padrino stuff in a branch, so I could maybe just use that branch to test out the fixes and let you know if it solves the problem.
@dcu @nesquena I tried with the reloader branch and it is much better. However maybe not great. I still have 10-20 s to reload the controller. This time was around 1-2 min before, so it's a great improvement.
What it does is:
I'm a bit confused by why it's reloading the models. It seems to be reloading all models, but I'm not 100% sure.
Hope this helps!
@PatrickLef just added a couple of debugging statements, can you bundle update padrino, start padrino and then show us the output?
bundle update padrino
@dcu Sorry for a late answer. Here is the output:https://gist.github.com/268896dec05fd883f576
If I add "puts 'model'" into every model it will write "model" a lot of times when reloading the controller. Even though it says that it only reloads the controller.
@PatrickLef do you think it's possible to eliminate those warnings?
@dcu I eliminated those warnings by adding requires to the files that where giving those warnings. However it's still reloading all the models after one controller has been changed. Is there anything more I can do to help you?
I've been investigating this issue. the problem is here: https://github.com/padrino/padrino-framework/blob/master/padrino-core/lib/padrino-core/reloader.rb#L67
it reloads all app files if the reloaded file is a controller or helper. the problem can be alleviate if we dont force the app file reloading here: https://github.com/padrino/padrino-framework/blob/master/padrino-core/lib/padrino-core/application.rb#L54
but I am not sure whether that would work or not because of the way controllers and helpers work.
@dcu Have you made any progress with this bug? Is there any way I can help you?
@DAddYE can we get away with not forcing the whole app reloading as @dcu suggests or we should we leave as it is and live with it?
We can't prevent that easily. Without that if you change a model the controller will not see it. Same if we change a controller we should reload all of them (to rebuild paths).
Tricky, we should wait 1.0 and maybe anticipate the new fork reloader.
I imagined the answer was along those lines... I'll move this for 1.0 then.
The reloader branch really makes everything much quicker, is it possible to see that merged in before the 1.0 releade?
The issue is with circular dependencies. If your models go like this:
has_tons :of, S
then Loader will try to load a.rb (fail), then s.rb, then again a.rb and succeed.
Though I can't imagine how intricate should the app be to make 2 min of circular loading.
@padrino/core-members what do you think of caching successful load order of features for Padrino.require_dependencies? It should quicken reload times in some cases.
That's a really interesting idea. If the load works correctly, caching that order would mean a smoother reload experience after that. But as you said, it's hard to imagine even how it works now taking 2 mins.
Okay, I'm closing this issue due to significant changes in reloader behavior. Please create new issue if you experience slow reloading on Padrino master.