pgtk 0.20.0 → 0.20.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8177f7980e33d9ef9a42fa130f732f1e8109175c417798e4e1046b0f72ae0a85
4
- data.tar.gz: 43fca371b69dd3aaf154fca4b2d912edd6fd4709c6c6f09bc525749c2023fa92
3
+ metadata.gz: e94b2347f021d0eef4c02d7b577ed273746f50d86dfd3db1a1bbbf41760f1d13
4
+ data.tar.gz: 414a7a9ea1d453e3a7dd8bf1d726a63b61c8c935a6a6c2cf397d68712029adfa
5
5
  SHA512:
6
- metadata.gz: 9cdddfb02085dfa5b48209aa0f4aace1825ba91d60f44fa9c5d736b78b8180086cecad8e25894f2b0cd16a3156c3e497af412ba67f0fcecf11684ae798f75872
7
- data.tar.gz: f94264b6a3610ca388156430feb567ac405d6b785a92a15c4557b153b3edbbb4c22280c306cac3f0ed7b4b5e8792c93d423da8854c74078d6b1b851da5fe2ebc
6
+ metadata.gz: 03ca46751802f3c5b5d0c78c2a81738c1b04acb26ea44504d9892a35f8fc7136559e03e9c7f6c870399c86b0df83abc9cb0f88a7d299cf4380e117da5a86bf4e
7
+ data.tar.gz: b6c4fed5e2a39f383250335efa8ea2a06f6914bcc4794405ff0f8f412523164bb65abb5c7bf2f07de89b02a8f7478563eb943605a1a8104951f672f3c084a536
data/lib/pgtk/stash.rb CHANGED
@@ -87,7 +87,7 @@ class Pgtk::Stash
87
87
  @pool.dump,
88
88
  '',
89
89
  "Pgtk::Stash (refill_interval=#{@refill_interval}s, top=#{@top}q, threads=#{@threads}t):",
90
- " #{'not ' unless @stash[:launched]}launched",
90
+ " #{'not ' if @stash[:launched].false?}launched",
91
91
  " #{@stash[:tables].count} tables in cache",
92
92
  " #{@stash[:queries].count} queries in cache:",
93
93
  qq.sort_by { -_1[2] }.take(20).map { |a| " #{a[1]}/#{a[2]}p/#{a[3]}s: #{a[0]}" }
@@ -123,21 +123,21 @@ class Pgtk::Stash
123
123
  ret = @pool.exec(pure, params, result)
124
124
  unless pure.include?(' NOW() ')
125
125
  @entrance.with_write_lock do
126
- @stash[:queries][pure] ||= {}
127
- @stash[:queries][pure][key] = { ret:, params:, result: }
128
126
  tables = pure.scan(/(?<=^|\s)(?:FROM|JOIN) ([a-z_]+)(?=\s|$)/).map(&:first).uniq
127
+ raise "No tables at #{pure.inspect}" if tables.empty?
129
128
  tables.each do |t|
130
129
  @stash[:tables][t] = [] if @stash[:tables][t].nil?
131
130
  @stash[:tables][t].append(pure).uniq!
132
131
  end
133
- raise "No tables at #{pure.inspect}" if tables.empty?
132
+ @stash[:queries][pure] ||= {}
133
+ @stash[:queries][pure][key] = { ret:, params:, result: }
134
134
  end
135
135
  end
136
136
  end
137
- if @stash.dig(:queries, query, key)
137
+ if @stash.dig(:queries, pure, key)
138
138
  @entrance.with_write_lock do
139
- @stash[:queries][query][key][:popularity] ||= 0
140
- @stash[:queries][query][key][:popularity] += 1
139
+ @stash[:queries][pure][key][:popularity] ||= 0
140
+ @stash[:queries][pure][key][:popularity] += 1
141
141
  end
142
142
  end
143
143
  end
data/lib/pgtk/version.rb CHANGED
@@ -11,5 +11,5 @@ require_relative '../pgtk'
11
11
  # License:: MIT
12
12
  module Pgtk
13
13
  # Current version of the library.
14
- VERSION = '0.20.0'
14
+ VERSION = '0.20.1'
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko