Skip to content

Commit 465fcdc

Browse files
committed
update
1 parent 3c72e12 commit 465fcdc

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

lib/stack-service-base/fiber_pool.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,29 @@ class FiberConnectionPool < Sequel::ConnectionPool
77
POOL_SIZE = 10
88

99
def log(msg)
10+
otl_current_span{ |span|
11+
span.add_event("Fiber:log", attributes:{
12+
event: 'Success', message: msg
13+
}.transform_keys(&:to_s) )
14+
}
15+
1016
return if defined? PERFORMANCE
1117
$stdout.puts "F:#{Fiber.current.__id__} : T:#{Thread.current.__id__} : A:#{self.__id__} : #{msg}"
1218
# LOGGER.debug :fiber_pool, msg
1319
end
1420

1521
def initialize(db, opts = OPTS)
16-
super
17-
@allocator = ->() {
18-
make_new(:default).tap { |conn|
19-
log "new connection (fiber pool) #{conn}"
22+
otl_span "FiberConnectionPool.initialize" do |span|
23+
super
24+
@allocator = ->() {
25+
make_new(:default).tap { |conn|
26+
log "new connection (fiber pool) #{conn}"
27+
}
2028
}
21-
}
22-
@stock = []
23-
@acquired = {}
24-
@sp = Async::Semaphore.new opts[:max_connections] || POOL_SIZE
29+
@stock = []
30+
@acquired = {}
31+
@sp = Async::Semaphore.new opts[:max_connections] || POOL_SIZE
32+
end
2533
end
2634

2735
def is_valid_connection?(conn)

lib/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module StackServiceBase
22
class Base
3-
VERSION = '0.0.16'
3+
VERSION = '0.0.17'
44
end
55
end

0 commit comments

Comments
 (0)