0

I´m using Rufus Scheduler 3.0.3 in a Ruby on Rails 4.1.4 web app and it´s working great with Unicorn. I moved to Puma and it´s great but I have realized Rufus is not working with Puma (daemonized).

I have read this issue #183 (comment) https://github.com/puma/puma/issues/183#issuecomment-59386038 that is closed for an earlier version, but it´s still not working and not clear to me if there is already a fix for it.

I don´t know if there is a workaround in the meantime.

UPDATE: There are not much logs to display, my rufus scheduler tasks are working when running with Unicorn, but If I change the server to Puma, it doesn´t run any automated task on my laptop. Even there is not any log to show.

I just add my current Rufus scheduler file:

task_scheduler.rb:

begin 

  require 'rufus-scheduler'

  scheduler = Rufus::Scheduler.new

  #Secretary responsible for executing events every 60 seconds.
  scheduler.every '60s' do
    Secretary.executeEvents
  end

  # Statistics (Owner) calculation every 1 day.
  scheduler.every '24h' do
    StatisticsCalculator.updateOwnerStatistics
  end
end

Am I missing any configuration?

On the Puma side, I just have this config file config/puma/development.rb with only this:

 stdout_redirect 'log/puma.stdout.log', 'log/puma.stderr.log', true

I don´t set up any workers, etc...

Rober
  • 5,868
  • 17
  • 58
  • 110
  • rufus-scheduler issue #183 doesn't exist https://github.com/jmettraux/rufus-scheduler/issues/183 – jmettraux Nov 24 '14 at 09:06
  • try to replace your Secretary.executeEvents with some simple logging statements to see if they appear, make it very simple and report here how you do it. Preferably, just use a plain "puts". You don't mention what Ruby you use, what OS you use, you don't tell how you start puma, you're not saying if you're using Sinatra or Rails, ... Wake up! – jmettraux Nov 24 '14 at 09:09
  • I didn´t say issue #183 is on Rufus side. But in Puma side... ruby 2.1.2p95, rails 4.1.4, Mac osx Mavericks. I started Puma daemonized with bundle exec puma -p 8080 -e development -S ~/puma -C config/puma/development.rb -d – Rober Nov 24 '14 at 09:24
  • as said in the comments below, you don't need Sinatra, you don't need to call configure like I do. Do not mix everything. Please think like a programmer, not like a copy-paste monk. – jmettraux Nov 24 '14 at 10:08
  • I´m starting to get sick with your comments. If I added that code it´s because as I told you, I don´t know anything about Sinatra,so I didn´t know it was related to it. I added it just to try, because it´s supposed you are the expert and you are suggesting me. So, I will remove it, and still it´s not working (of course in my development enviroment). I see you try to edit my post, to let people clear the "possible" issue is not on Rufus side. Are you suggesting finally there is an issue? So, what is your veredict? Wake up!! – Rober Nov 24 '14 at 10:28
  • I told you below that you did not need Sinatra at all. I did not suggest you to add that code at all. I gave you a mini project to test, I did not gave you a mini project to mix in your own project. Good luck! – jmettraux Nov 24 '14 at 10:36
  • See my answer below. – Rober Nov 24 '14 at 20:27

2 Answers2

1

No, it works.

I packaged this sample project for you:

https://github.com/jmettraux/for_rober

Rufus-scheduler 3.0.3 schedules just fine with Puma 2.9.2 (Ruby 1.9.3 on Debian GNU/Linux).

Thanks for not blaming other people's work without facts.

If there really is an issue, I suggest you go and read http://www.chiark.greenend.org.uk/~sgtatham/bugs.html, then read it again, three times. It's most surely available in your native language. Then, if you really think rufus-scheduler is the culprit, go and open a detailed issue report at https://github.com/jmettraux/rufus-scheduler/issues Beware posting crappy "it doesn't work" material, it'll earn you only negative reactions.

UPDATE:

I strongly suggest you clone my mini-project on your machine and try it, then report the results here in the comments. The details are in the README.md of the project.

UPDATE:

Roberto is trying to get this issue solved in parallel, directly at https://github.com/puma/puma/issues/607

jmettraux
  • 3,511
  • 3
  • 31
  • 30
  • Hi, I apologyze for the title of the post. I just assumed according to many entries I saw in the issue history. I have updated it. Thanks for the sample project, I see it´s working. However, there are a couple of differences with mine. See my updated post above for clarification details. – Rober Nov 24 '14 at 09:07
  • No, you don't need Sinatra at all. Thanks for changing the title, it was driving me mad. If you need help, it's your responsibility to bring all the relevant facts to the table. If you use Rails, you'll have to tell which version you're using. See my comment above, directly under your question. – jmettraux Nov 24 '14 at 09:13
1

Finally, it looks there was an small issue. It has been kindly fixed by the Puma guys.

Please, see: https://github.com/puma/puma/issues/607

Rober
  • 5,868
  • 17
  • 58
  • 110
  • I still think you should cleanup the question itself. The "I have added Sinatra" part you have added is confusing for future readers. – jmettraux Nov 24 '14 at 20:33