{"action":"created","issue":{"url":"https://api.github.com/repos/resque/resque-scheduler/issues/571","repository_url":"https://api.github.com/repos/resque/resque-scheduler","labels_url":"https://api.github.com/repos/resque/resque-scheduler/issues/571/labels{/name}","comments_url":"https://api.github.com/repos/resque/resque-scheduler/issues/571/comments","events_url":"https://api.github.com/repos/resque/resque-scheduler/issues/571/events","html_url":"https://github.com/resque/resque-scheduler/issues/571","id":168664616,"number":571,"title":"dynamic resque schedule changes do not get picked up by scheduler","user":{"login":"greatavi79","id":20730609,"avatar_url":"https://avatars.githubusercontent.com/u/20730609?v=3","gravatar_id":"","url":"https://api.github.com/users/greatavi79","html_url":"https://github.com/greatavi79","followers_url":"https://api.github.com/users/greatavi79/followers","following_url":"https://api.github.com/users/greatavi79/following{/other_user}","gists_url":"https://api.github.com/users/greatavi79/gists{/gist_id}","starred_url":"https://api.github.com/users/greatavi79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greatavi79/subscriptions","organizations_url":"https://api.github.com/users/greatavi79/orgs","repos_url":"https://api.github.com/users/greatavi79/repos","events_url":"https://api.github.com/users/greatavi79/events{/privacy}","received_events_url":"https://api.github.com/users/greatavi79/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-08-01T14:50:08Z","updated_at":"2016-08-02T18:43:18Z","closed_at":null,"body":"The dynamic schedules do not work even on providing Resque::Scheduler.dynamic = true and DYNAMIC_SCHEDULE=true.\r\nThe schedules do get updated on resque-web but the schedule changes do not get picked up by the scheduler. For ex, the removed schedules no longer appear on resque-web but they still get run by scheduler.\r\nThe setup is as follows:\r\n(A) Redis: Deployed in a docker container. \r\nRedis server version:  2.8.4\r\n\r\n(B) Resque: Deployed in another docker container started with a link to redis server (--link redis:db). This container also contains resque-scheduler and resque-pool.\r\nresque version: 1.26.0\r\nresque-pool version:  0.6.0\r\nresque-scheduler version: 4.3.0\r\nrufus-scheduler version: 3.2.1\r\n\r\n(C) resque.rb (in Resque container web-app's config/initializers):\r\n---\r\nrequire \"redis\"\r\nrequire 'resque-scheduler'\r\nrequire 'resque/scheduler/server'\r\n\r\nREDIS_SERVER = Redis.new(:host => ENV[\"DB_PORT_6379_TCP_ADDR\"], :port =>  ENV[\"DB_PORT_6379_TCP_PORT\"])\r\nResque.redis = REDIS_SERVER\r\n\r\nResque::Scheduler.dynamic = true\r\nResque.schedule = YAML.load_file('resque_schedule.yml')\r\n---\r\n\r\n(D) resque.rake (in Resque container web-app's lib/tasks)\r\n---\r\nrequire \"resque/tasks\"\r\nrequire 'resque/pool/tasks'\r\nrequire 'resque/scheduler/tasks'\r\nrequire \"redis\"\r\nrequire 'resque-scheduler'\r\nrequire 'resque/scheduler/server'\r\n\r\nnamespace :resque do\r\n  task :setup => :environment do\r\n    require 'resque'\r\n\r\n    Resque.redis = REDIS_SERVER\r\n  end\r\n\r\n  task :setup_schedule => :setup do\r\n    require 'resque-scheduler'\r\n\r\n    Resque::Scheduler.dynamic = true\r\n  end\r\n\r\n  task :scheduler => :setup_schedule\r\n\r\n  task \"pool:setup\" do\r\n    ActiveRecord::Base.connection.disconnect!\r\n    Resque::Pool.after_prefork do |job|\r\n      ActiveRecord::Base.establish_connection\r\n      Resque.redis.client.reconnect\r\n    end\r\n  end\r\n\r\nend\r\n---\r\n\r\n(E) Within resque container:\r\n(a) The resque workers are started using:\r\nresque-pool --daemon --environment production\r\n(b) The resque scheduler is started using:\r\nrake environment resque:scheduler DYNAMIC_SCHEDULE=true\r\n\r\n(F) On the fly, the resque schedules are updated using Resque.set_schedule and Resque.remove_schedule methods."},"comment":{"url":"https://api.github.com/repos/resque/resque-scheduler/issues/comments/237001856","html_url":"https://github.com/resque/resque-scheduler/issues/571#issuecomment-237001856","issue_url":"https://api.github.com/repos/resque/resque-scheduler/issues/571","id":237001856,"user":{"login":"greatavi79","id":20730609,"avatar_url":"https://avatars.githubusercontent.com/u/20730609?v=3","gravatar_id":"","url":"https://api.github.com/users/greatavi79","html_url":"https://github.com/greatavi79","followers_url":"https://api.github.com/users/greatavi79/followers","following_url":"https://api.github.com/users/greatavi79/following{/other_user}","gists_url":"https://api.github.com/users/greatavi79/gists{/gist_id}","starred_url":"https://api.github.com/users/greatavi79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greatavi79/subscriptions","organizations_url":"https://api.github.com/users/greatavi79/orgs","repos_url":"https://api.github.com/users/greatavi79/repos","events_url":"https://api.github.com/users/greatavi79/events{/privacy}","received_events_url":"https://api.github.com/users/greatavi79/received_events","type":"User","site_admin":false},"created_at":"2016-08-02T18:43:18Z","updated_at":"2016-08-02T18:43:18Z","body":"@carsonreinke yes dev2_ReleaseWorker is loaded from load_file. dev4_ReleaseWorker is scheduled using:\r\nResque.set_schedule(env.name + \"_\" + @@module_worker_map[mod_type], generate_schedule(env, mod))\r\n\r\nwhere generate_schedule is:\r\ndef self.generate_schedule(env, mod)\r\n    schedule_map = Hash.new\r\n    args = Array.new\r\n    schedule_map.store(\"cron\", mod.schedule)\r\n    schedule_map.store(\"class\", @@module_worker_map[mod.mod_type])\r\n    args.push(mod.env_id.to_s)\r\n    args.push(mod.id.to_s)\r\n    schedule_map.store(\"queue\", @@worker_queue_map[@@module_worker_map[mod.mod_type]])\r\n    schedule_map.store(\"args\", args)\r\n    schedule_map.store(\"description\", \"This job queues \" + @@module_worker_map[mod.mod_type] + \" on \" + env.name)\r\n    return schedule_map\r\n  end\r\n\r\nI had tried setting Resque.redis only once as well (only in resque.rb), but same behavior."}}
{"actor":{"display_login":"greatavi79"}}