Skip to content

Commit 8a365c1

Browse files
committed
Fix bugs haha.
1 parent 7db82cb commit 8a365c1

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

config/sus.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55

66
require "covered/sus"
77
include Covered::Sus
8+
9+
ENV["TRACES_BACKEND"] ||= "traces/backend/test"

lib/async/pool/controller.rb

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,9 @@ def acquire_or_create_resource
390390
def create_resource(...)
391391
attributes = {
392392
concurrency: @guard.limit,
393-
size: @resources.size,
394-
limit: @limit,
395393
}
396394

397-
@attributes.merge!(@tags) if @tags
395+
attributes.merge!(@tags) if @tags
398396

399397
Traces.trace('async.pool.create', attributes: attributes) {super}
400398
end
@@ -404,44 +402,38 @@ def drain(...)
404402
size: @resources.size,
405403
}
406404

407-
@attributes.merge!(@tags) if @tags
405+
attributes.merge!(@tags) if @tags
408406

409407
Traces.trace('async.pool.drain', attributes: attributes) {super}
410408
end
411409

412410
def acquire(...)
413411
attributes = {
414-
concurrency: @guard.limit,
415412
size: @resources.size,
416413
limit: @limit,
417414
}
418415

419-
@attributes.merge!(@tags) if @tags
416+
attributes.merge!(@tags) if @tags
420417

421418
Traces.trace('async.pool.acquire', attributes: attributes) {super}
422419
end
423420

424421
def release(...)
425422
attributes = {
426-
concurrency: @guard.limit,
427423
size: @resources.size,
428-
limit: @limit,
429424
}
430425

431-
@attributes.merge!(@tags) if @tags
426+
attributes.merge!(@tags) if @tags
432427

433428
Traces.trace('async.pool.release', attributes: attributes) {super}
434429
end
435430

436431
def retire(...)
437432
attributes = {
438-
concurrency: @guard.limit,
439433
size: @resources.size,
440-
limit: @limit,
441-
**@tags,
442434
}
443435

444-
@attributes.merge!(@tags) if @tags
436+
attributes.merge!(@tags) if @tags
445437

446438
Traces.trace('async.pool.retire', attributes: attributes) {super}
447439
end

test/async/pool/controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
let(:pool) {subject.new(Async::Pool::Resource, tags: {a: 1, b: 2})}
5151

5252
it "can assign tags to the pool" do
53-
expect(pool.tags).to be == ["a:1", "b:2"]
53+
expect(pool.tags).to be == {a: 1, b: 2}
5454
end
5555
end
5656

0 commit comments

Comments
 (0)