From b70bdb2fd9ad4850d72ca91e0fe1f4d163b13876 Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Mon, 6 Nov 2023 21:21:39 +0100 Subject: [PATCH] Reduction --- app/jobs/create_submission_file_job.rb | 1 - app/jobs/e6_iqdb_query_job.rb | 1 - app/jobs/scrape_artist_url_job.rb | 1 - test/logical/job_stats_test.rb | 8 +------- 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/app/jobs/create_submission_file_job.rb b/app/jobs/create_submission_file_job.rb index 38309f10..b0916981 100644 --- a/app/jobs/create_submission_file_job.rb +++ b/app/jobs/create_submission_file_job.rb @@ -2,7 +2,6 @@ class CreateSubmissionFileJob < ApplicationJob queue_as :submission_download - good_job_control_concurrency_with(total_limit: 1, key: -> { "#{arguments.first.id}-#{arguments.second[:identifier]}" }) def perform(artist_submission, file) submission_file = SubmissionFile.find_by(artist_submission: artist_submission, file_identifier: file[:identifier]) diff --git a/app/jobs/e6_iqdb_query_job.rb b/app/jobs/e6_iqdb_query_job.rb index 1cd57e88..f248b2d3 100644 --- a/app/jobs/e6_iqdb_query_job.rb +++ b/app/jobs/e6_iqdb_query_job.rb @@ -2,7 +2,6 @@ class E6IqdbQueryJob < ApplicationJob queue_as :e6_iqdb - good_job_control_concurrency_with(total_limit: 1, key: -> { arguments.first.id }) PRIORITIES = { immediate: 100, diff --git a/app/jobs/scrape_artist_url_job.rb b/app/jobs/scrape_artist_url_job.rb index ced34e58..a54388ea 100644 --- a/app/jobs/scrape_artist_url_job.rb +++ b/app/jobs/scrape_artist_url_job.rb @@ -2,7 +2,6 @@ class ScrapeArtistUrlJob < ApplicationJob queue_as :scraping - good_job_control_concurrency_with(total_limit: 1, key: -> { arguments.first.id }) def perform(artist_url) # rubocop:disable Metrics/CyclomaticComplexity return unless artist_url.scraper_enabled? diff --git a/test/logical/job_stats_test.rb b/test/logical/job_stats_test.rb index bee0bc06..868590f9 100644 --- a/test/logical/job_stats_test.rb +++ b/test/logical/job_stats_test.rb @@ -20,15 +20,9 @@ class JobStatsTest < ActiveSupport::TestCase [submission1, submission2, submission3].each { |submission| CreateSubmissionFileJob.perform_later(submission, {}) } [file1, file2, file3, file4, file5].each { |file| E6IqdbQueryJob.perform_later(file) } - puts GoodJob::Job.count puts GoodJob::Job.all.map(&:to_json) - stats = JobStats.new - - assert_equal({ url1.id => 1, url2.id => 1 }, stats.scraping_queued) - assert_equal({ url1.id => 2, url2.id => 1 }, stats.submission_download_queued) - assert_equal({ url1.id => 3, url2.id => 2 }, stats.e6_iqdb_queued) - assert_equal([url1.id, url2.id].sort, stats.active_urls.sort) + assert_equal(10, GoodJob::Job.count) end it "returns the correct values for currently running scraping jobs" do