This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_list_of_messages | |
| #100 pages per worker at max | |
| max_number_of_urls = 100 | |
| puts "Getting messages from IronMQ" | |
| messages = @iron_mq_client.messages.get(:n => max_number_of_urls, :timeout => 100) | |
| puts "Got messages from queue - #{messages.count}" | |
| messages | |
| end | |
| #getting list of urls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| client = IronWorkerNG::Client.new | |
| params = { | |
| # include the params the scheduled job needs | |
| } | |
| client.schedules.create("notification_scheduler", params, | |
| :start_at => Time.now, :run_every => 60*60*24) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| users = User.all | |
| users.each_slice(100) do |users_slice| | |
| client = IronWorkerNG::Client.new | |
| params = {# include the params the worker needs | |
| } | |
| client.tasks.create("notification_worker", params) | |
| end |