<commit_before>require 'sidekiq_middlewares'
require 'sidekiq/middleware/i18n'

# Single process-mode
if AppConfig.environment.single_process_mode? && Rails.env != "test"
  if Rails.env == 'production'
    puts "WARNING: You are running Diaspora in production without Sidekiq"
    puts "         workers turned on.  Please set single_process_mode to false in"
    puts "         config/diaspora.yml."
  end
  require 'sidekiq/testing/inline'
end

def (Sidekiq::Logging).logger
  defined?(@logger) ? @logger : (AppConfig.heroku? ? initialize_logger : initialize_logger(AppConfig.sidekiq_log))
end

Sidekiq.configure_server do |config|
  config.redis = AppConfig.get_redis_options

  config.options = config.options.merge({
    concurrency: AppConfig.environment.sidekiq.concurrency.to_i,
    queues: %w{
      socket_webfinger
      photos
      http_service
      dispatch
      mail
      delete_account
      receive_local
      receive
      receive_salmon
      http
      default
    }
  })

  config.server_middleware do |chain|
    chain.add SidekiqMiddlewares::CleanAndShortBacktraces
  end

  # Set connection pool on Heroku
  database_url = ENV['DATABASE_URL']
  if(database_url)
    ENV['DATABASE_URL'] = "#{database_url}?pool=#{AppConfig.environment.sidekiq.concurrency.get}"
    ActiveRecord::Base.establish_connection
  end
  <commit_msg>let default sidekiq config actually process the maintenance queue<commit_after>require 'sidekiq_middlewares'
require 'sidekiq/middleware/i18n'

# Single process-mode
if AppConfig.environment.single_process_mode? && Rails.env != "test"
  if Rails.env == 'production'
    puts "WARNING: You are running Diaspora in production without Sidekiq"
    puts "         workers turned on.  Please set single_process_mode to false in"
    puts "         config/diaspora.yml."
  end
  require 'sidekiq/testing/inline'
end

def (Sidekiq::Logging).logger
  defined?(@logger) ? @logger : (AppConfig.heroku? ? initialize_logger : initialize_logger(AppConfig.sidekiq_log))
end

Sidekiq.configure_server do |config|
  config.redis = AppConfig.get_redis_options

  config.options = config.options.merge({
    concurrency: AppConfig.environment.sidekiq.concurrency.to_i,
    queues: %w{
      socket_webfinger
      photos
      http_service
      dispatch
      mail
      delete_account
      receive_local
      receive
      receive_salmon
      http
      maintenance
      default
    }
  })

  config.server_middleware do |chain|
    chain.add SidekiqMiddlewares::CleanAndShortBacktraces
  end

  # Set connection pool on Heroku
  database_url = ENV['DATABASE_URL']
  if(database_url)
    ENV['DATABASE_URL'] = "#{database_url}?pool=#{AppConfig.environment.sidekiq.concurrency.get}"
    ActiveRecord::Base.establish_connection
  end
  
{'fraction_non_alphanumeric': 0.08795962509012256, 'fraction_numerical': 0.0014419610670511895, 'mean_word_length': 3.6560402684563758, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4867239', 'n_tokens_mistral': 892, 'n_tokens_neox': 872, 'n_words': 183}