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 +4 -4
- data/lib/pgtk/stash.rb +7 -7
- data/lib/pgtk/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: e94b2347f021d0eef4c02d7b577ed273746f50d86dfd3db1a1bbbf41760f1d13
|
|
4
|
+
data.tar.gz: 414a7a9ea1d453e3a7dd8bf1d726a63b61c8c935a6a6c2cf397d68712029adfa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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 '
|
|
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
|
-
|
|
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,
|
|
137
|
+
if @stash.dig(:queries, pure, key)
|
|
138
138
|
@entrance.with_write_lock do
|
|
139
|
-
@stash[:queries][
|
|
140
|
-
@stash[:queries][
|
|
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