Skip to content

Commit

Permalink
Fix bugs haha.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Oct 13, 2024
1 parent 7db82cb commit 8a365c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
2 changes: 2 additions & 0 deletions config/sus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@

require "covered/sus"
include Covered::Sus

ENV["TRACES_BACKEND"] ||= "traces/backend/test"
18 changes: 5 additions & 13 deletions lib/async/pool/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,9 @@ def acquire_or_create_resource
def create_resource(...)
attributes = {
concurrency: @guard.limit,
size: @resources.size,
limit: @limit,
}

@attributes.merge!(@tags) if @tags
attributes.merge!(@tags) if @tags

Traces.trace('async.pool.create', attributes: attributes) {super}
end
Expand All @@ -404,44 +402,38 @@ def drain(...)
size: @resources.size,
}

@attributes.merge!(@tags) if @tags
attributes.merge!(@tags) if @tags

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

def acquire(...)
attributes = {
concurrency: @guard.limit,
size: @resources.size,
limit: @limit,
}

@attributes.merge!(@tags) if @tags
attributes.merge!(@tags) if @tags

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

def release(...)
attributes = {
concurrency: @guard.limit,
size: @resources.size,
limit: @limit,
}

@attributes.merge!(@tags) if @tags
attributes.merge!(@tags) if @tags

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

def retire(...)
attributes = {
concurrency: @guard.limit,
size: @resources.size,
limit: @limit,
**@tags,
}

@attributes.merge!(@tags) if @tags
attributes.merge!(@tags) if @tags

Traces.trace('async.pool.retire', attributes: attributes) {super}
end
Expand Down
2 changes: 1 addition & 1 deletion test/async/pool/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
let(:pool) {subject.new(Async::Pool::Resource, tags: {a: 1, b: 2})}

it "can assign tags to the pool" do
expect(pool.tags).to be == ["a:1", "b:2"]
expect(pool.tags).to be == {a: 1, b: 2}
end
end

Expand Down

0 comments on commit 8a365c1

Please sign in to comment.