rufus-scheduler

Best way to not run rufus-scheduler when starting a rails console

橙三吉。 提交于 2019-12-22 06:35:10
问题 I use rufus-scheduler to run some periodic tasks, but they are extremely annoying to have in the rails console when I just want to test things. Is there an easy way to stop all rufus-scheduler tasks when starting a console automatically? In the code that starts the scheduler if i can check that i am just in a rails console I can not run them, or if there is a way to run some callbacks when the console starts I can also shut them down there. Thanks 回答1: Based on Rails check if IRB console or

Rufus scheduler running multiple times with unicorn, fixed with :lockfile, but how to eliminate the error msg?

对着背影说爱祢 提交于 2019-12-22 04:25:06
问题 scheduler = Rufus::Scheduler.new :lockfile => ".rufus-scheduler.lock" scheduler.every("60") do ... end Environment: Ubuntu, rails 4, rufus, unicorn, nginx Unicorn has multiple workers, so the above 'every' task will be executed multiple times every 60 seconds. According to the answer for this one: rufus scheduler running twice each time , I added :lockfile option, and it works! However, from the log, it seems that the 'every' task still tries to be called, resulting in a lot of error messages

rufus-scheduler and delayed_job on Heroku: why use a worker dyno?

北城以北 提交于 2019-12-14 03:42:09
问题 I'm developing a Rails 3.2.16 app and deploying to a Heroku dev account with one free web dyno and no worker dynos. I'm trying to determine if a (paid) worker dyno is really needed. The app sends various emails. I use delayed_job_active_record to queue those and send them out. I also need to check a notification count every minute. For that I'm using rufus-scheduler. rufus-scheduler seems able to run a background task/thread within a Heroku web dyno. On the other hand, everything I can find

rufus scheduler running twice each time

自闭症网瘾萝莉.ら 提交于 2019-12-13 06:27:12
问题 Maybe it's my task, maybe it's my scheduler, but for some reason my scheduled task is running twice or saving two versions to the DB. Here's my code: report.rb: def record_page_stats! oauth = Koala::Facebook::OAuth.new @api = Koala::Facebook::API.new oauth.get_app_access_token @fb_page = @api.get_object(self.fb_page_id) self.page_stats.new(like_count: @fb_page["likes"], talking_about_count: @fb_page["talking_about_count"]) self.save end AND the scheduler.rb: require 'rufus-scheduler'

Issue with rufus-scheduler when we have multiple EC2 instances

女生的网名这么多〃 提交于 2019-12-13 04:25:00
问题 I have deployed rails app on two EC2 instances. I have scheduled on Job with rufus-scheduler to run every 24 hours to send some emails. But scheduler is running separately on two instances. I need run scheduler on only one instance. So can you please help with this issue? Thanks 回答1: Let's assume you've followed https://github.com/jmettraux/rufus-scheduler#so-rails You could modify the initializer in this way: # # config/initializers/scheduler.rb require 'rufus-scheduler' s = Rufus::Scheduler

Rails_using Rufus in order to schedule sending mails daily

一曲冷凌霜 提交于 2019-12-12 02:15:57
问题 I want to schedule sending mails using Rufus-scheduler in a Rails app deployed on Heroku. My code looks like # config/initializers/scheduler.rb require 'rufus-scheduler' s = Rufus::Scheduler.singleton s.every '11h30m' do # here I put my sending mail task (already tested, and works well) end But nothing happened, and I can't figure out the issue based on my logs I suspected some points: 1- Is my procfile correct ? Do I need something else in order to use Passenger ? will the classic webrick

Apache/Passenger rufus cron job not working

旧城冷巷雨未停 提交于 2019-12-11 19:25:36
问题 I have a Rails app running on Apache/Passenger. I have a rufus cron job that runs in the background and sends out notifications via email. When I am running the app in development on the WEBrick server, the emails are sent like they are supposed to be sent. When I start up the app in production on Apache/Passenger, then the emails dont get sent. The class doing the work is in config/initializers/task_scheduler.rb require 'rubygems' require 'rufus/scheduler' Rails.logger.info "Starting the

Rufus Scheduler :first_in option unknown with cron

。_饼干妹妹 提交于 2019-12-10 10:34:38
问题 I am trying to use the Rufus Scheduler (within Dashing) to schedule a cron job, but also have it run once upon the server spinning up. I am following the readme here where it is saying to do the following: scheduler.cron '00 14 * * *', :first_in => '3d' do # ... every day at 14h00, but start after 3 * 24 hours end When I try to do this, I get the following error in my job: `cron': unknown option: :first_in (ArgumentError) Has anyone come across this? 回答1: Dashing is using rufus-scheduler 2.0

How to avoid Rufus scheduler being called as many times as there are no.of dynos?

谁说胖子不能爱 提交于 2019-12-08 11:06:57
问题 I am running a rails app in Heroku where I use Rufus Scheduler. My app uses more than one dyno and the scheduler is running on each dyno rather than just one, so my scheduled events are firing multiple times (once for each dyno ). How can I avoid this? 回答1: You should add a new process type in your Procfile that runs your Rufus scheduler process: web: unicorn -c app/config/unicorn.rb ... # Your existing web dyno process scheduler: rake rufus:scheduler # Add rake task for rufus scheduler

Debugging Rufus scheduler

我的未来我决定 提交于 2019-12-08 07:14:28
问题 I am doing this in my Rails console: job = scheduler.at 1.minute.from_now do Service.log.debug 'scheduler works' end job.schedule_info => Wed, 07 Aug 2013 16:14:46 UTC 00:00 scheduler is defined in other file: require 'rubygems' require 'rufus/scheduler' def scheduler @scheduler ||= Rufus::Scheduler.start_new end And when I run in console: Service.log.debug 'scheduler works' Service log file is written. Problem scheduler.at 1.minute.from_now do Service.log.debug 'scheduler works' end Does not