Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spelling of "visibility" #538

Merged
merged 2 commits into from
Nov 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/shoryuken.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ module Shoryuken
:on_start,
:on_stop,
:on,
:cache_visiblity_timeout?,
:cache_visiblity_timeout=
:cache_visibility_timeout?,
:cache_visibility_timeout=
)
end

Expand Down
10 changes: 5 additions & 5 deletions lib/shoryuken/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Options
@@stop_callback = nil
@@worker_executor = Worker::DefaultExecutor
@@launcher_executor = nil
@@cache_visiblity_timeout = false
@@cache_visibility_timeout = false

class << self
def active_job?
Expand Down Expand Up @@ -222,12 +222,12 @@ def server?
defined?(Shoryuken::CLI)
end

def cache_visiblity_timeout?
@@cache_visiblity_timeout
def cache_visibility_timeout?
@@cache_visibility_timeout
end

def cache_visiblity_timeout=(cache_visiblity_timeout)
@@cache_visiblity_timeout = cache_visiblity_timeout
def cache_visibility_timeout=(cache_visibility_timeout)
@@cache_visibility_timeout = cache_visibility_timeout
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/shoryuken/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def initialize(client, name_or_url)
end

def visibility_timeout
# Always lookup for the latest visiblity when cache is disabled
# Always lookup for the latest visibility when cache is disabled
# setting it to nil, forces re-lookup
@_visibility_timeout = nil unless Shoryuken.cache_visiblity_timeout?
@_visibility_timeout = nil unless Shoryuken.cache_visibility_timeout?
@_visibility_timeout ||= queue_attributes.attributes[VISIBILITY_TIMEOUT_ATTR].to_i
end

Expand Down
6 changes: 3 additions & 3 deletions spec/shoryuken/queue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def call(options)
end
end

describe '#visiblity_timeout' do
describe '#visibility_timeout' do
let(:attribute_response) { double 'Aws::SQS::Types::GetQueueAttributesResponse' }

before do
Expand All @@ -247,7 +247,7 @@ def call(options)

context 'when cache is disabled' do
specify do
Shoryuken.cache_visiblity_timeout = false
Shoryuken.cache_visibility_timeout = false

expect(sqs).to(
receive(:get_queue_attributes).with(queue_url: queue_url, attribute_names: ['All']).and_return(attribute_response).exactly(3).times
Expand All @@ -260,7 +260,7 @@ def call(options)

context 'when cache is enabled' do
it 'memoizes response' do
Shoryuken.cache_visiblity_timeout = true
Shoryuken.cache_visibility_timeout = true

expect(sqs).to(
receive(:get_queue_attributes).with(queue_url: queue_url, attribute_names: ['All']).and_return(attribute_response).once
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def perform(sqs_msg, body); end

Shoryuken.sqs_client_receive_message_opts.clear

Shoryuken.cache_visiblity_timeout = false
Shoryuken.cache_visibility_timeout = false

allow(Concurrent).to receive(:global_io_executor).and_return(Concurrent::ImmediateExecutor.new)
allow(Shoryuken).to receive(:active_job?).and_return(false)
Expand Down