Skip to content

Commit

Permalink
Update standardrb gem, formatting update
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Nov 30, 2022
1 parent aac4237 commit b8fa4d1
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/sidekiq/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def enqueue_to(queue, klass, *args)
def enqueue_to_in(queue, interval, klass, *args)
int = interval.to_f
now = Time.now.to_f
ts = (int < 1_000_000_000 ? now + int : int)
ts = ((int < 1_000_000_000) ? now + int : int)

item = {"class" => klass, "args" => args, "at" => ts, "queue" => queue}
item.delete("at") if ts <= now
Expand Down
4 changes: 2 additions & 2 deletions lib/sidekiq/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def perform_in(interval, *args)
def at(interval)
int = interval.to_f
now = Time.now.to_f
ts = (int < 1_000_000_000 ? now + int : int)
ts = ((int < 1_000_000_000) ? now + int : int)
# Optimization to enqueue something now that is scheduled to go out now or in the past
@opts["at"] = ts if ts > now
self
Expand Down Expand Up @@ -325,7 +325,7 @@ def perform_bulk(*args, **kwargs)
def perform_in(interval, *args)
int = interval.to_f
now = Time.now.to_f
ts = (int < 1_000_000_000 ? now + int : int)
ts = ((int < 1_000_000_000) ? now + int : int)

item = {"class" => self, "args" => args}

Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq/metrics/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def total_avg(metric = "ms")
def series_avg(metric = "ms")
series[metric].each_with_object(Hash.new(0)) do |(bucket, value), result|
completed = series.dig("p", bucket) - series.dig("f", bucket)
result[bucket] = completed == 0 ? 0 : value.to_f / completed
result[bucket] = (completed == 0) ? 0 : value.to_f / completed
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def tags_for(process)
tags = [
process["tag"],
process["labels"],
(process["quiet"] == "true" ? "quiet" : nil)
((process["quiet"] == "true") ? "quiet" : nil)
].flatten.compact
tags.any? ? "[#{tags.join("] [")}]" : nil
end
Expand Down
4 changes: 2 additions & 2 deletions lib/sidekiq/paginator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Sidekiq
module Paginator
def page(key, pageidx = 1, page_size = 25, opts = nil)
current_page = pageidx.to_i < 1 ? 1 : pageidx.to_i
current_page = (pageidx.to_i < 1) ? 1 : pageidx.to_i
pageidx = current_page - 1
total_size = 0
items = []
Expand Down Expand Up @@ -45,7 +45,7 @@ def page(key, pageidx = 1, page_size = 25, opts = nil)
end

def page_items(items, pageidx = 1, page_size = 25)
current_page = pageidx.to_i < 1 ? 1 : pageidx.to_i
current_page = (pageidx.to_i < 1) ? 1 : pageidx.to_i
pageidx = current_page - 1
starting = pageidx * page_size
items = items.to_a
Expand Down
6 changes: 3 additions & 3 deletions lib/sidekiq/web/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def t(msg, options = {})
end

def sort_direction_label
params[:direction] == "asc" ? "&uarr;" : "&darr;"
(params[:direction] == "asc") ? "&uarr;" : "&darr;"
end

def workset
Expand Down Expand Up @@ -184,7 +184,7 @@ def current_path
end

def current_status
workset.size == 0 ? "idle" : "active"
(workset.size == 0) ? "idle" : "active"
end

def relative_time(time)
Expand Down Expand Up @@ -217,7 +217,7 @@ def to_query_string(params)
end

def truncate(text, truncate_after_chars = 2000)
truncate_after_chars && text.size > truncate_after_chars ? "#{text[0..truncate_after_chars]}..." : text
(truncate_after_chars && text.size > truncate_after_chars) ? "#{text[0..truncate_after_chars]}..." : text
end

def display_args(args, truncate_after_chars = 2000)
Expand Down
2 changes: 1 addition & 1 deletion test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class DJob < BaseJob
it "allows middleware to stop bulk jobs" do
mware = Class.new do
def call(worker_klass, msg, q, r)
msg["args"][0] == 1 ? yield : false
(msg["args"][0] == 1) ? yield : false
end
end
@client.middleware do |chain|
Expand Down
2 changes: 1 addition & 1 deletion test/retry_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def job
max_retries = 7
1.upto(max_retries + 1) do |i|
assert_raises RuntimeError do
job = i > 1 ? jobstr("retry_count" => i - 2) : jobstr
job = (i > 1) ? jobstr("retry_count" => i - 2) : jobstr
@config[:max_retries] = max_retries
handler.local(worker, job, "default") do
raise "kerblammo!"
Expand Down
3 changes: 1 addition & 2 deletions test/web_helpers_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ def env
end

def default
{
}
{}
end

def path_info
Expand Down

0 comments on commit b8fa4d1

Please sign in to comment.