Skip to content

Commit

Permalink
Reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain committed Nov 6, 2023
1 parent 2549727 commit b70bdb2
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 10 deletions.
1 change: 0 additions & 1 deletion app/jobs/create_submission_file_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
1 change: 0 additions & 1 deletion app/jobs/e6_iqdb_query_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion app/jobs/scrape_artist_url_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
8 changes: 1 addition & 7 deletions test/logical/job_stats_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b70bdb2

Please sign in to comment.