Skip to content

Commit 89cff65

Browse files
committed
Rename any_changes to any_unique_opts
A small change to rename variable `any_changes` to `any_unique_opts`, which is more appropriate giving its presence in the path where unique options are constructed.
1 parent 0152af2 commit 89cff65

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/client.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def insert_many(args)
149149
private def check_unique_job(insert_params, unique_opts, &block)
150150
return block.call if unique_opts.nil?
151151

152-
any_changes = false
152+
any_unique_opts = false
153153
get_params = Driver::JobGetByKindAndUniquePropertiesParam.new(kind: insert_params.kind)
154154

155155
# It's extremely important here that this lock string format and algorithm
@@ -159,35 +159,35 @@ def insert_many(args)
159159
lock_str += "kind=#{insert_params.kind}"
160160

161161
if unique_opts.by_args
162-
any_changes = true
162+
any_unique_opts = true
163163
get_params.encoded_args = insert_params.encoded_args
164164
lock_str += "&args=#{insert_params.encoded_args}"
165165
end
166166

167167
if unique_opts.by_period
168168
lower_period_bound = truncate_time(@time_now_utc.call, unique_opts.by_period).utc
169169

170-
any_changes = true
170+
any_unique_opts = true
171171
get_params.created_at = [lower_period_bound, lower_period_bound + unique_opts.by_period]
172172
lock_str += "&period=#{lower_period_bound.strftime("%FT%TZ")}"
173173
end
174174

175175
if unique_opts.by_queue
176-
any_changes = true
176+
any_unique_opts = true
177177
get_params.queue = insert_params.queue
178178
lock_str += "&queue=#{insert_params.queue}"
179179
end
180180

181181
if unique_opts.by_state
182-
any_changes = true
182+
any_unique_opts = true
183183
get_params.state = unique_opts.by_state
184184
lock_str += "&state=#{unique_opts.by_state.join(",")}"
185185
else
186186
get_params.state = DEFAULT_UNIQUE_STATES
187187
lock_str += "&state=#{DEFAULT_UNIQUE_STATES.join(",")}"
188188
end
189189

190-
return block.call unless any_changes
190+
return block.call unless any_unique_opts
191191

192192
@driver.transaction do
193193
lock_key = if @advisory_lock_prefix.nil?

0 commit comments

Comments
 (0)