sqlui 0.1.81 → 0.1.82
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/.release-version +1 -1
- data/app/github/tree_client.rb +2 -15
- data/app/server.rb +7 -3
- 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: 2ea6baae4e715638e52392661dbae71c35028d29f13b44ab9c10392e7d784bbc
|
4
|
+
data.tar.gz: 55949e1df33c47a5a8833ce0e97894f8f958eaa7767bd76767231f47e91ae377
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abd1e5cf01a0afdd4b1f952c1ae7ffc41f0849836187a867199a975f40efdde0d35b9db719f2f6a6b71c7cf41ed04c3415c4508c1f77e15c6f9e4393e7b1d2a3
|
7
|
+
data.tar.gz: 79776d1afa3caffe7c9332702d18a0d8cb58f9e4427dd073808b805249f809d50c2cd5a32a96bcb866fa3f5d9ca92153773283b9d278bbf393ab73c42a240abb
|
data/.release-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.82
|
data/app/github/tree_client.rb
CHANGED
@@ -53,8 +53,8 @@ module Github
|
|
53
53
|
latch = CountDownLatch.new(tree_size)
|
54
54
|
response['tree'].each do |blob|
|
55
55
|
TreeClient.thread_pool.post do
|
56
|
-
blob['
|
57
|
-
|
56
|
+
blob_response = @client.get_with_caching(blob['url'], cache_for: DEFAULT_MAX_FILE_CACHE_AGE_SECONDS)
|
57
|
+
blob['content'] = Base64.decode64(blob_response['content'])
|
58
58
|
ensure
|
59
59
|
latch.count_down
|
60
60
|
end
|
@@ -133,18 +133,5 @@ module Github
|
|
133
133
|
}
|
134
134
|
)
|
135
135
|
end
|
136
|
-
|
137
|
-
private
|
138
|
-
|
139
|
-
# Returns the contents of the file at the specified path. Uses the cache.
|
140
|
-
def get_file_content_with_caching(owner:, repo:, path:, ref:)
|
141
|
-
check_non_empty_string(owner: owner, repo: repo, sha: ref, path: path)
|
142
|
-
|
143
|
-
response = @client.get_with_caching(
|
144
|
-
"https://api.github.com/repos/#{owner}/#{repo}/contents/#{path}?ref=#{ref}",
|
145
|
-
cache_for: DEFAULT_MAX_FILE_CACHE_AGE_SECONDS
|
146
|
-
)
|
147
|
-
Base64.decode64(response['content'])
|
148
|
-
end
|
149
136
|
end
|
150
137
|
end
|
data/app/server.rb
CHANGED
@@ -123,7 +123,6 @@ class Server < Sinatra::Base
|
|
123
123
|
)
|
124
124
|
# Prefetch all trees on startup. This should happen before the health endpoint is available.
|
125
125
|
unless ENV.fetch('DISABLE_PREFETCH', '0') == '1'
|
126
|
-
Sqlui.logger.info 'prefetch'
|
127
126
|
tree_client.get_tree(
|
128
127
|
owner: saved_config.owner,
|
129
128
|
repo: saved_config.repo,
|
@@ -379,7 +378,12 @@ class Server < Sinatra::Base
|
|
379
378
|
return Github::Cache.new({}, logger: Sqlui.logger) unless ENV['USE_LOCAL_SAVED_FILES']
|
380
379
|
|
381
380
|
paths = Dir.glob('sql/**/*.sql')
|
382
|
-
blobs = paths.map
|
381
|
+
blobs = paths.map do |path|
|
382
|
+
{
|
383
|
+
'path' => path,
|
384
|
+
'url' => "https://api.github.com/repos/nicholasdower/sqlui/git/blobs/#{Base64.encode64(path)}"
|
385
|
+
}
|
386
|
+
end
|
383
387
|
github_cache_hash = {
|
384
388
|
'https://api.github.com/repos/nicholasdower/sqlui/git/trees/master?recursive=true' =>
|
385
389
|
Github::Cache::Entry.new(
|
@@ -391,7 +395,7 @@ class Server < Sinatra::Base
|
|
391
395
|
)
|
392
396
|
}
|
393
397
|
paths.each do |path|
|
394
|
-
github_cache_hash["https://api.github.com/repos/nicholasdower/sqlui/
|
398
|
+
github_cache_hash["https://api.github.com/repos/nicholasdower/sqlui/git/blobs/#{Base64.encode64(path)}"] =
|
395
399
|
Github::Cache::Entry.new(
|
396
400
|
{
|
397
401
|
'content' => Base64.encode64(File.read(path))
|