<commit_before>require 'heroku'
require 'resque/plugins/resque_heroku_autoscaler'

module Resque::Plugins::HerokuAutoscaler
  alias set_workers_without_cache set_workers
  def set_workers number_of_workers
    Rails.cache.write('heroku.worker.count', set_workers_without_cache(number_of_workers), :expires_in => 1.minute)
  end
  
  alias current_workers_without_cache current_workers
  def current_workers
    Rails.cache.fetch('heroku.worker.count', :expires_in => 1.minute) do
      current_workers_without_cache
    end
  end
end

Resque::Plugins::HerokuAutoscaler.config do |c|
  c.heroku_user = ''<commit_msg>Only scale every 10 seconds<commit_after>require 'heroku'
require 'resque/plugins/resque_heroku_autoscaler'

module Resque::Plugins::HerokuAutoscaler
  alias set_workers_without_cache set_workers
  def set_workers number_of_workers
    Rails.cache.fetch('heroku.worker.refresh', :expires_in => 10.seconds) do
      Rails.cache.write('heroku.worker.count', set_workers_without_cache(number_of_workers), :expires_in => 1.minute)
    end
  end
  
  alias current_workers_without_cache current_workers
  def current_workers
    Rails.cache.fetch('heroku.worker.count', :expires_in => 1.minute) do
      current_workers_without_cache.tap do |count|
        Rails.cache.delete 'heroku.worker.refresh' if count.zero?
      end
    end
  end
end

Resque::Plugins::HerokuAutoscaler.config do |c|
  c.heroku_user = ''
{'fraction_non_alphanumeric': 0.09142053445850915, 'fraction_numerical': 0.005625879043600563, 'mean_word_length': 5.213973799126638, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5879267', 'n_tokens_mistral': 492, 'n_tokens_neox': 476, 'n_words': 84}