Skip to content
  • Sean McGivern's avatar
    Explicitly set retries to 3 for all existing Sidekiq workers · ab0f9788
    Sean McGivern authored
    Some time ago, we set the default number of Sidekiq retries to 3. In the
    next commit we're going to change that to 25, but we only want it to
    apply to new workers. So we'll first need to explicitly set all existing
    workers to 3.
    
    To aid with this, I used the below script. I had to make a couple of
    tweaks for some worker concerns, but it covered most of the several
    hundred workers we have:
    
        Dir.glob('{ee/,}app/workers/**/*.rb').select do |worker|
          contents = open(worker).read
    
          next unless contents.include?('ApplicationWorker')
          next if contents.include?('sidekiq_options retry: ')
    
          new_contents =
            contents.gsub(/^( +)include ApplicationWorker$/,
                          "\\1include ApplicationWorker\n\n" +
                          "\\1sidekiq_options retry: 3")
    
          open(worker, 'w').puts(new_contents)
        end
    ab0f9788