Hi! I just found out that my initializers (in config/initializers) get called four (4!) times when I run "heroku restart".
This is a big problem for me, because I am spawning processes and timers in my initializers, and end up with more parallel processes than I want. (I'm using the Spawn plugin and rufus-scheduler gem for this.) I'm loggin to a debug db table. After running "heroku restart", this is what I get: Start scheduling exorcist #<Rufus::Scheduler:0xb702a5b4> Start scheduling exorcist #<Rufus::Scheduler:0xb6fbc53c> Start scheduling exorcist #<Rufus::Scheduler:0xb6f9ea14> Exorcist still active : #<Rufus::Scheduler:0xb702a5b4> Exorcist still active : #<Rufus::Scheduler:0xb6fbc53c> Exorcist still active : #<Rufus::Scheduler:0xb6f9ea14> Exorcist still active : #<Rufus::Scheduler:0xb702a5b4> Start scheduling exorcist #<Rufus::Scheduler:0xb6f6f930> Exorcist still active : #<Rufus::Scheduler:0xb6fbc53c> Exorcist still active : #<Rufus::Scheduler:0xb6f9ea14> Exorcist still active : #<Rufus::Scheduler:0xb702a5b4> Exorcist still active : #<Rufus::Scheduler:0xb6f6f930> Exorcist still active : #<Rufus::Scheduler:0xb6fbc53c> As you can see, my initializer is called four times, and I get four "exorcists" running at the same time, which totally screws up the behavior of my app. Any ideas about why this is happening, and what I can do about it? (I could of course try to set flags in the db to signal that a process is already running, but that seems like a heavy-handed and lame solution.) I thought initilizers were supposed to run *once* when the server is started, per spec. I'm not even getting this problem when I'm running on Mongrel in development mode locally: it never calls initializers additional times while the server is running. -------- Ok, I switched to production mode on heroku, but that also didn't work. In fact, whereas before the initializers were called four times in rapid succession when just after doing a restart, now they are called once in a while. This seems buggy to me. Please give some feedback. If you think this is not a bug, perhaps you could advice me on how to avoid spawning additional processes? Many thanks! /Felix --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/heroku?hl=en -~----------~----~----~----~------~----~------~--~---
