stack-service-base 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/stack-service-base/fiber_pool.rb +16 -8
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19fe497cb600a2f7618d3ae4ec8cf25862381804c0b51c2e73096f9ed3493e40
|
4
|
+
data.tar.gz: d9d9c062161159b12895ebb3aa143d08b80cff20de829a2c85b68392647c395c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41303c5e2005b8669959f8fbfc29d8318da4101a9a9b166a49d7fb768cad82c598731801b2cf892f1d3323bd682950397c751ead4ab1184ccea019393934602f
|
7
|
+
data.tar.gz: a3337e079cc9053b267b955e472b9994e90062e1254ab27ae2d857c0aa3c55307214492f945355c03d53c1763246485082af97fc40ad9adbdc64dd5a63fe69ad
|
@@ -7,21 +7,29 @@ class FiberConnectionPool < Sequel::ConnectionPool
|
|
7
7
|
POOL_SIZE = 10
|
8
8
|
|
9
9
|
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
|
+
|
10
16
|
return if defined? PERFORMANCE
|
11
17
|
$stdout.puts "F:#{Fiber.current.__id__} : T:#{Thread.current.__id__} : A:#{self.__id__} : #{msg}"
|
12
18
|
# LOGGER.debug :fiber_pool, msg
|
13
19
|
end
|
14
20
|
|
15
21
|
def initialize(db, opts = OPTS)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
+
}
|
20
28
|
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
29
|
+
@stock = []
|
30
|
+
@acquired = {}
|
31
|
+
@sp = Async::Semaphore.new opts[:max_connections] || POOL_SIZE
|
32
|
+
end
|
25
33
|
end
|
26
34
|
|
27
35
|
def is_valid_connection?(conn)
|
data/lib/version.rb
CHANGED