Skip to content

Commit

Permalink
Refactor queue adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
tawan committed Nov 19, 2016
1 parent 013b32d commit 51c9b9c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/active_job/queue_adapters/active_elastic_job_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ class ActiveElasticJobAdapter
MAX_MESSAGE_SIZE = (256 * 1024)
MAX_DELAY_IN_MINUTES = 15

if Gem::Version.new(Aws::VERSION) >= Gem::Version.new('2.2.19')
AWS_CLIENT_VERIFIES_MD5_DIGESTS = true
else
AWS_CLIENT_VERIFIES_MD5_DIGESTS = false
end

extend ActiveElasticJob::MD5MessageDigestCalculation

class Error < RuntimeError; end;
Expand Down Expand Up @@ -63,7 +57,8 @@ def initialize(queue_name)
Unfortunately a queue with this name does not exist in this
region. Either create an Amazon SQS queue named #{queue_name} -
you can do this in AWS console, make sure to select region
'#{ENV['AWS_REGION']}' - or you select another queue for your jobs.
'#{Rails.application.config.active_elastic_job.aws_region}' - or you
select another queue for your jobs.
MSG
end
end
Expand Down Expand Up @@ -119,7 +114,7 @@ def enqueue_at(job, timestamp) #:nodoc:
private

def aws_client_verifies_md5_digests?
return AWS_CLIENT_VERIFIES_MD5_DIGESTS
Gem::Version.new(Aws::VERSION) >= Gem::Version.new('2.2.19'.freeze)
end

def build_message(queue_name, serialized_job, timestamp)
Expand Down

0 comments on commit 51c9b9c

Please sign in to comment.