Backgroundrb works well on windows, but it does not work on my production system(CentOS), it just prints out the follow log, but the test worker has never been call:( Very strange, any idea? log: DRb URI: druby://localhost:22222 Pid: 4327 Autostart... test_worker done code: class TestWorker < BackgrounDRb::Rails repeat_every 1.minutes first_run Time.now def do_work(args) puts "[test worker] do_work..." end end yml: --- port: "22222" timer_sleep: 60 load_rails: true environment: production host: localhost database_yml: config/database.yml acl: deny: all allow: localhost 127.0.0.1 order: deny,allow autostart: test_worker: class: test_worker args: bar -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Ezra Zygmuntowicz
2006-Sep-15 17:07 UTC
Re: Backgroundrb works well on windows but failed on CentOS...
On Sep 15, 2006, at 12:07 AM, cafebabe wrote:> > Backgroundrb works well on windows, but it does not work on my > production system(CentOS), it just prints out the follow log, but the > test worker has > never been call:( Very strange, any idea? > log: > DRb URI: druby://localhost:22222 > Pid: 4327 > Autostart... > test_worker > done > > code: > class TestWorker < BackgrounDRb::Rails > repeat_every 1.minutes > first_run Time.now > def do_work(args) > puts "[test worker] do_work..."@logger.debug "[test worker] do_work..."> end > endYou can use puts in a worker like that. You need to use @logger. -Ezra --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
cafebabe
2006-Sep-16 13:21 UTC
Re: Backgroundrb works well on windows but failed on CentOS.
Ezra Zygmuntowicz wrote:> On Sep 15, 2006, at 12:07 AM, cafebabe wrote: > >> done >> >> code: >> class TestWorker < BackgrounDRb::Rails >> repeat_every 1.minutes >> first_run Time.now >> def do_work(args) >> puts "[test worker] do_work..." > @logger.debug "[test worker] do_work..." >> end >> end > > > You can use puts in a worker like that. You need to use @logger. > > -Ezraresovled. backgroundrb_rails.rb has a method: def self.first_run(time) class_eval <<-e def schedule_first_run Time.parse("#{time}") end e end to determin when to run workers, Time.parse("#{time}") can not properly parse "#{Time.now}" on my centos server, it returns a time object 1 day from now, so my worker will started 1 day later... So I think time.kind_of?(Time) ? time : Time.parse("#{time}") would be better And I found that althought the time zone on my centos server is Asia/Shanghai, but Time.now return a time object of CST, when I change the time zone to Asia/Hong_Kong, it works well, crazy... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---