response_bank 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/response_bank/version.rb +1 -1
- data/lib/response_bank.rb +14 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b24a992a093711fd04ac8768221300e0c238a70b02ea40c49f87a3c05a1b87af
|
4
|
+
data.tar.gz: 4665251a057b21f12858b55332f45e8be3587cc9aa787082be32df8082971256
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 834669e94059637b751b22783ad10c731b2a327f83bc1448e13d26532506bdb55145b6c12eb29c49fc635cf3cacdc9d6b5cad7c1e62af99000330b5b77e72c5c
|
7
|
+
data.tar.gz: c6dccc62b543bef77132a8cfa1de1608c8a32db5abb9c610d71c743e8b94538e079d132f70b90bfb18addf0181f3c1627bd73a45c8e727532a7378cfd7d9399a
|
data/lib/response_bank.rb
CHANGED
@@ -33,7 +33,20 @@ module ResponseBank
|
|
33
33
|
def compress(content, encoding = "br")
|
34
34
|
case encoding
|
35
35
|
when 'gzip'
|
36
|
-
|
36
|
+
attempts = 0
|
37
|
+
|
38
|
+
begin
|
39
|
+
Zlib.gzip(content, level: Zlib::BEST_COMPRESSION)
|
40
|
+
rescue Zlib::BufError
|
41
|
+
# We get sporadic Zlib::BufError, so we retry once (https://github.com/ruby/zlib/issues/49)
|
42
|
+
attempts += 1
|
43
|
+
|
44
|
+
if attempts <= 1
|
45
|
+
retry
|
46
|
+
else
|
47
|
+
raise
|
48
|
+
end
|
49
|
+
end
|
37
50
|
when 'br'
|
38
51
|
Brotli.deflate(content, mode: :text, quality: 7)
|
39
52
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: response_bank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Lütke
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
rubygems_version: 3.4
|
149
|
+
rubygems_version: 3.5.4
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: Simple response caching for Ruby applications
|