sidekiq

Sidekiq to execute at specific time in every timezones

三世轮回 提交于 2021-02-18 17:21:22
问题 Using Sidekiq, what are the strategy to have it execute at a particular time in every time zone? For example, I need Sidekiq to perform a task every day at the following time and time zones across the world: ... 8:00 PM EST 8:00 PM CST 8:00 PM MST 8:00 PM PST ... 回答1: I would just run the same job at the start of each hour. You might want to use cron to run the job each hour or have a look at this list on how to create recurring jobs in Sidekiq. The first step within the job is to figure out

Sidekiq calling methods in library files

巧了我就是萌 提交于 2021-02-11 15:55:48
问题 I´m new to sidekiq. I tested a very basic example and it´s working fine. Now, inside my job, I would like to call a method that is in a library in my lib folder but I´m getting some errors related to paths. First, I define the files and structure: I have created a worker in my-project/app/workers/hard-worker.rb require 'sidekiq' Sidekiq.configure_client do |config| config.redis = {db:1} end Sidekiq.configure_server do |config| config.redis = {db:1} end class HardWorker include Sidekiq::Worker

How can I specify different concurrency queues for sidekiq configuration?

落花浮王杯 提交于 2021-02-11 15:23:27
问题 I have the following sidekiq.yml config file, but I'm not sure how to build a separate queue with lower concurrency. How can I do this? --- :concurrency: 25 :pidfile: ./tmp/pids/sidekiq.pid :logfile: ./log/sidekiq.log :queues: - default - [high_priority, 2] - [import_queue, 3] - [user_queue, 4] :daemon: true I would like to do something like the following though, --- :concurrency: 25 :pidfile: ./tmp/pids/sidekiq.pid :logfile: ./log/sidekiq.log :queues: - default - [high_priority, 2] - [import

BackgroundJob triggered multiple times on save ( Rails 5, Sidekiq)

血红的双手。 提交于 2021-02-11 12:55:49
问题 I am handling the upload of PDFs' files on Cloundinary through a background jobs. I enqueue them from an after_save callback. The dilemna is that for one update my background job get triggered multiples times. To counter this flaw, I tried to implement a method using around_perform , to ensure that my job would be triggered only one time. But it actually did not work. I was wondering if any of you know how to handle those unwanted calls to the job Here is my code My after_save callback The

Start sidekiq automatically on OSX

坚强是说给别人听的谎言 提交于 2021-02-08 11:52:12
问题 I have coded up a small ruby gem that I use on my laptop to check disk space and other things. I am using a sidekiq worker that runs periodically and emails me status updates. I was wondering how to make a sidekiq worker run automatically after I restart OSX? Is this possible? Cheers 回答1: To run sidekiq you need to run: bundle exec sidekiq . If you want to run this on startup then you can follow these steps: Start Automator.app; Select "Application"; Click "Show library" in the toolbar (if

Rendering a Rails view from within a Sidekiq Worker

我是研究僧i 提交于 2021-02-07 08:22:23
问题 I have a Sidekiq worker that does some background processing and then finally POSTs a success message to a 3rd party API. This message I post is essentially a "thank you" message and can contain HTML. In the message I'd like to link back to my site in a properly formatted way. This naturally sounds like a view to me. I'd love to simply use a view template, render it to HTML and finally post it off to the API. For the life of me, i cannot figure how to render a view from within my Sidekiq

Rendering a Rails view from within a Sidekiq Worker

痴心易碎 提交于 2021-02-07 08:20:35
问题 I have a Sidekiq worker that does some background processing and then finally POSTs a success message to a 3rd party API. This message I post is essentially a "thank you" message and can contain HTML. In the message I'd like to link back to my site in a properly formatted way. This naturally sounds like a view to me. I'd love to simply use a view template, render it to HTML and finally post it off to the API. For the life of me, i cannot figure how to render a view from within my Sidekiq

Basic Sidekiq Questions about Idempotency and functions

╄→尐↘猪︶ㄣ 提交于 2021-01-29 12:03:38
问题 I'm using Sidekiq to perform some heavy processing in the background. I looked online but couldn't find the answers to the following questions. I am using: Class.delay.use_method(listing_id) And then, inside the class, I have a self.use_method(listing_id) listing = Listing.find_by_id listing_id UserMailer.send_mail(listing) Class.call_example_function() Two questions: How do I make this function idempotent for the UserMailer sendmail? In other words, in case the delayed method runs twice, how

LoadError: Unable to autoload constant (Rails + Sidekiq)

烈酒焚心 提交于 2020-12-12 05:19:15
问题 In my development environement I am getting this error : WARN: LoadError: Unable to autoload constant Alerts::FailedReportWorker, expected /my-path/app/workers/alerts/failed_report_worker.rb to define it. I have these workers in my schedule.yml file : alert_sla_worker: cron: "*/1 * * * *" class: "Alerts::SlaWorker" alert_failed_export_worker: cron: "*/1 * * * *" class: "Alerts::FailedExportWorker" alert_failed_report_worker: cron: "*/1 * * * *" class: "Alerts::FailedReportWorker" alert_failed