Commit
+98 -79 +/-4 browse
1 | diff --git a/Cargo.lock b/Cargo.lock |
2 | index a4fad66..ac443d3 100644 |
3 | --- a/Cargo.lock |
4 | +++ b/Cargo.lock |
5 | @@ -113,15 +113,16 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" |
6 | |
7 | [[package]] |
8 | name = "backoff" |
9 | - version = "0.2.1" |
10 | + version = "0.3.0" |
11 | source = "registry+https://github.com/rust-lang/crates.io-index" |
12 | - checksum = "721c249ab59cbc483ad4294c9ee2671835c1e43e9ffc277e6b4ecfef733cfdc5" |
13 | + checksum = "9fe17f59a06fe8b87a6fc8bf53bb70b3aba76d7685f432487a68cd5552853625" |
14 | dependencies = [ |
15 | "futures-core", |
16 | + "getrandom 0.2.2", |
17 | "instant", |
18 | - "pin-project 0.4.27", |
19 | - "rand", |
20 | - "tokio 0.2.25", |
21 | + "pin-project 1.0.5", |
22 | + "rand 0.8.3", |
23 | + "tokio", |
24 | ] |
25 | |
26 | [[package]] |
27 | @@ -165,12 +166,6 @@ checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" |
28 | |
29 | [[package]] |
30 | name = "bytes" |
31 | - version = "0.5.6" |
32 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
33 | - checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" |
34 | - |
35 | - [[package]] |
36 | - name = "bytes" |
37 | version = "1.0.1" |
38 | source = "registry+https://github.com/rust-lang/crates.io-index" |
39 | checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" |
40 | @@ -451,7 +446,7 @@ dependencies = [ |
41 | "futures-sink", |
42 | "futures-task", |
43 | "memchr", |
44 | - "pin-project-lite 0.2.4", |
45 | + "pin-project-lite", |
46 | "pin-utils", |
47 | "proc-macro-hack", |
48 | "proc-macro-nested", |
49 | @@ -496,7 +491,7 @@ version = "0.3.0" |
50 | source = "registry+https://github.com/rust-lang/crates.io-index" |
51 | checksum = "6b67e66362108efccd8ac053abafc8b7a8d86a37e6e48fc4f6f7485eb5e9e6a5" |
52 | dependencies = [ |
53 | - "bytes 1.0.1", |
54 | + "bytes", |
55 | "fnv", |
56 | "futures-core", |
57 | "futures-sink", |
58 | @@ -504,7 +499,7 @@ dependencies = [ |
59 | "http", |
60 | "indexmap", |
61 | "slab", |
62 | - "tokio 1.2.0", |
63 | + "tokio", |
64 | "tokio-util", |
65 | "tracing", |
66 | "tracing-futures", |
67 | @@ -562,7 +557,7 @@ version = "0.2.3" |
68 | source = "registry+https://github.com/rust-lang/crates.io-index" |
69 | checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" |
70 | dependencies = [ |
71 | - "bytes 1.0.1", |
72 | + "bytes", |
73 | "fnv", |
74 | "itoa", |
75 | ] |
76 | @@ -573,7 +568,7 @@ version = "0.4.0" |
77 | source = "registry+https://github.com/rust-lang/crates.io-index" |
78 | checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994" |
79 | dependencies = [ |
80 | - "bytes 1.0.1", |
81 | + "bytes", |
82 | "http", |
83 | ] |
84 | |
85 | @@ -622,7 +617,7 @@ version = "0.14.4" |
86 | source = "registry+https://github.com/rust-lang/crates.io-index" |
87 | checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" |
88 | dependencies = [ |
89 | - "bytes 1.0.1", |
90 | + "bytes", |
91 | "futures-channel", |
92 | "futures-core", |
93 | "futures-util", |
94 | @@ -634,7 +629,7 @@ dependencies = [ |
95 | "itoa", |
96 | "pin-project 1.0.5", |
97 | "socket2", |
98 | - "tokio 1.2.0", |
99 | + "tokio", |
100 | "tower-service", |
101 | "tracing", |
102 | "want", |
103 | @@ -652,7 +647,7 @@ dependencies = [ |
104 | "log", |
105 | "rustls", |
106 | "rustls-native-certs", |
107 | - "tokio 1.2.0", |
108 | + "tokio", |
109 | "tokio-rustls", |
110 | "webpki", |
111 | ] |
112 | @@ -928,12 +923,6 @@ dependencies = [ |
113 | |
114 | [[package]] |
115 | name = "pin-project-lite" |
116 | - version = "0.1.11" |
117 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
118 | - checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" |
119 | - |
120 | - [[package]] |
121 | - name = "pin-project-lite" |
122 | version = "0.2.4" |
123 | source = "registry+https://github.com/rust-lang/crates.io-index" |
124 | checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" |
125 | @@ -1046,9 +1035,21 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" |
126 | dependencies = [ |
127 | "getrandom 0.1.16", |
128 | "libc", |
129 | - "rand_chacha", |
130 | - "rand_core", |
131 | - "rand_hc", |
132 | + "rand_chacha 0.2.2", |
133 | + "rand_core 0.5.1", |
134 | + "rand_hc 0.2.0", |
135 | + ] |
136 | + |
137 | + [[package]] |
138 | + name = "rand" |
139 | + version = "0.8.3" |
140 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
141 | + checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" |
142 | + dependencies = [ |
143 | + "libc", |
144 | + "rand_chacha 0.3.0", |
145 | + "rand_core 0.6.2", |
146 | + "rand_hc 0.3.0", |
147 | ] |
148 | |
149 | [[package]] |
150 | @@ -1058,7 +1059,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" |
151 | checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" |
152 | dependencies = [ |
153 | "ppv-lite86", |
154 | - "rand_core", |
155 | + "rand_core 0.5.1", |
156 | + ] |
157 | + |
158 | + [[package]] |
159 | + name = "rand_chacha" |
160 | + version = "0.3.0" |
161 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
162 | + checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" |
163 | + dependencies = [ |
164 | + "ppv-lite86", |
165 | + "rand_core 0.6.2", |
166 | ] |
167 | |
168 | [[package]] |
169 | @@ -1071,12 +1082,30 @@ dependencies = [ |
170 | ] |
171 | |
172 | [[package]] |
173 | + name = "rand_core" |
174 | + version = "0.6.2" |
175 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
176 | + checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" |
177 | + dependencies = [ |
178 | + "getrandom 0.2.2", |
179 | + ] |
180 | + |
181 | + [[package]] |
182 | name = "rand_hc" |
183 | version = "0.2.0" |
184 | source = "registry+https://github.com/rust-lang/crates.io-index" |
185 | checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" |
186 | dependencies = [ |
187 | - "rand_core", |
188 | + "rand_core 0.5.1", |
189 | + ] |
190 | + |
191 | + [[package]] |
192 | + name = "rand_hc" |
193 | + version = "0.3.0" |
194 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
195 | + checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" |
196 | + dependencies = [ |
197 | + "rand_core 0.6.2", |
198 | ] |
199 | |
200 | [[package]] |
201 | @@ -1145,7 +1174,7 @@ dependencies = [ |
202 | "async-stream", |
203 | "async-trait", |
204 | "backoff", |
205 | - "bytes 1.0.1", |
206 | + "bytes", |
207 | "chacha", |
208 | "derive_more", |
209 | "futures", |
210 | @@ -1159,7 +1188,7 @@ dependencies = [ |
211 | "linked-hash-map", |
212 | "log", |
213 | "pretty_env_logger", |
214 | - "rand", |
215 | + "rand 0.7.3", |
216 | "rusoto_core", |
217 | "rusoto_credential", |
218 | "rusoto_s3", |
219 | @@ -1168,7 +1197,7 @@ dependencies = [ |
220 | "serde_json", |
221 | "sha2", |
222 | "structopt", |
223 | - "tokio 1.2.0", |
224 | + "tokio", |
225 | "tokio-util", |
226 | "url", |
227 | "uuid", |
228 | @@ -1182,7 +1211,7 @@ checksum = "02aff20978970d47630f08de5f0d04799497818d16cafee5aec90c4b4d0806cf" |
229 | dependencies = [ |
230 | "async-trait", |
231 | "base64", |
232 | - "bytes 1.0.1", |
233 | + "bytes", |
234 | "crc32fast", |
235 | "futures", |
236 | "http", |
237 | @@ -1195,7 +1224,7 @@ dependencies = [ |
238 | "rustc_version", |
239 | "serde", |
240 | "serde_json", |
241 | - "tokio 1.2.0", |
242 | + "tokio", |
243 | "xml-rs", |
244 | ] |
245 | |
246 | @@ -1213,7 +1242,7 @@ dependencies = [ |
247 | "serde", |
248 | "serde_json", |
249 | "shlex", |
250 | - "tokio 1.2.0", |
251 | + "tokio", |
252 | "zeroize", |
253 | ] |
254 | |
255 | @@ -1224,7 +1253,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" |
256 | checksum = "abc3f56f14ccf91f880b9a9c2d0556d8523e8c155041c54db155b384a1dd1119" |
257 | dependencies = [ |
258 | "async-trait", |
259 | - "bytes 1.0.1", |
260 | + "bytes", |
261 | "futures", |
262 | "rusoto_core", |
263 | "xml-rs", |
264 | @@ -1237,7 +1266,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" |
265 | checksum = "5486e6b1673ab3e0ba1ded284fb444845fe1b7f41d13989a54dd60f62a7b2baa" |
266 | dependencies = [ |
267 | "base64", |
268 | - "bytes 1.0.1", |
269 | + "bytes", |
270 | "futures", |
271 | "hex 0.4.2", |
272 | "hmac", |
273 | @@ -1246,13 +1275,13 @@ dependencies = [ |
274 | "log", |
275 | "md5", |
276 | "percent-encoding", |
277 | - "pin-project-lite 0.2.4", |
278 | + "pin-project-lite", |
279 | "rusoto_credential", |
280 | "rustc_version", |
281 | "serde", |
282 | "sha2", |
283 | "time", |
284 | - "tokio 1.2.0", |
285 | + "tokio", |
286 | ] |
287 | |
288 | [[package]] |
289 | @@ -1262,7 +1291,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" |
290 | checksum = "2f93005e0c3b9e40a424b50ca71886d2445cc19bb6cdac3ac84c2daff482eb59" |
291 | dependencies = [ |
292 | "async-trait", |
293 | - "bytes 1.0.1", |
294 | + "bytes", |
295 | "chrono", |
296 | "futures", |
297 | "rusoto_core", |
298 | @@ -1687,30 +1716,19 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" |
299 | |
300 | [[package]] |
301 | name = "tokio" |
302 | - version = "0.2.25" |
303 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
304 | - checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" |
305 | - dependencies = [ |
306 | - "bytes 0.5.6", |
307 | - "pin-project-lite 0.1.11", |
308 | - "slab", |
309 | - ] |
310 | - |
311 | - [[package]] |
312 | - name = "tokio" |
313 | version = "1.2.0" |
314 | source = "registry+https://github.com/rust-lang/crates.io-index" |
315 | checksum = "e8190d04c665ea9e6b6a0dc45523ade572c088d2e6566244c1122671dbf4ae3a" |
316 | dependencies = [ |
317 | "autocfg", |
318 | - "bytes 1.0.1", |
319 | + "bytes", |
320 | "libc", |
321 | "memchr", |
322 | "mio", |
323 | "num_cpus", |
324 | "once_cell", |
325 | "parking_lot", |
326 | - "pin-project-lite 0.2.4", |
327 | + "pin-project-lite", |
328 | "signal-hook-registry", |
329 | "tokio-macros", |
330 | "winapi", |
331 | @@ -1734,7 +1752,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" |
332 | checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" |
333 | dependencies = [ |
334 | "rustls", |
335 | - "tokio 1.2.0", |
336 | + "tokio", |
337 | "webpki", |
338 | ] |
339 | |
340 | @@ -1744,14 +1762,14 @@ version = "0.6.3" |
341 | source = "registry+https://github.com/rust-lang/crates.io-index" |
342 | checksum = "ebb7cb2f00c5ae8df755b252306272cd1790d39728363936e01827e11f0b017b" |
343 | dependencies = [ |
344 | - "bytes 1.0.1", |
345 | + "bytes", |
346 | "futures-core", |
347 | "futures-io", |
348 | "futures-sink", |
349 | "log", |
350 | - "pin-project-lite 0.2.4", |
351 | + "pin-project-lite", |
352 | "slab", |
353 | - "tokio 1.2.0", |
354 | + "tokio", |
355 | ] |
356 | |
357 | [[package]] |
358 | @@ -1776,7 +1794,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" |
359 | checksum = "f7d40a22fd029e33300d8d89a5cc8ffce18bb7c587662f54629e94c9de5487f3" |
360 | dependencies = [ |
361 | "cfg-if", |
362 | - "pin-project-lite 0.2.4", |
363 | + "pin-project-lite", |
364 | "tracing-core", |
365 | ] |
366 | |
367 | diff --git a/Cargo.toml b/Cargo.toml |
368 | index e13510d..dc8e199 100644 |
369 | --- a/Cargo.toml |
370 | +++ b/Cargo.toml |
371 | @@ -18,7 +18,7 @@ license = "MIT" |
372 | askama = "0.8" |
373 | async-stream = "0.3" |
374 | async-trait = "0.1" |
375 | - backoff = { version = "0.2", features = ["tokio"] } |
376 | + backoff = { version = "0.3", features = ["tokio"] } |
377 | bytes = "1" |
378 | chacha = "0.3" |
379 | derive_more = "0.99" |
380 | diff --git a/src/storage/retrying.rs b/src/storage/retrying.rs |
381 | index 8dd9281..246c28c 100644 |
382 | --- a/src/storage/retrying.rs |
383 | +++ b/src/storage/retrying.rs |
384 | @@ -20,7 +20,8 @@ |
385 | use std::sync::Arc; |
386 | |
387 | use async_trait::async_trait; |
388 | - use backoff::{future::FutureOperation, ExponentialBackoff}; |
389 | + use backoff::future::retry; |
390 | + use backoff::ExponentialBackoff; |
391 | |
392 | use super::{LFSObject, Storage, StorageKey, StorageStream}; |
393 | |
394 | @@ -65,15 +66,17 @@ where |
395 | } |
396 | |
397 | async fn size(&self, key: &StorageKey) -> Result<Option<u64>, Self::Error> { |
398 | - (|| async { Ok(self.storage.size(&key).await?) }) |
399 | - .retry(ExponentialBackoff::default()) |
400 | - .await |
401 | + retry(ExponentialBackoff::default(), || async { |
402 | + Ok(self.storage.size(&key).await?) |
403 | + }) |
404 | + .await |
405 | } |
406 | |
407 | async fn delete(&self, key: &StorageKey) -> Result<(), Self::Error> { |
408 | - (|| async { Ok(self.storage.delete(&key).await?) }) |
409 | - .retry(ExponentialBackoff::default()) |
410 | - .await |
411 | + retry(ExponentialBackoff::default(), || async { |
412 | + Ok(self.storage.delete(&key).await?) |
413 | + }) |
414 | + .await |
415 | } |
416 | |
417 | fn list(&self) -> StorageStream<(StorageKey, u64), Self::Error> { |
418 | diff --git a/src/storage/s3.rs b/src/storage/s3.rs |
419 | index cda5908..de1b05b 100644 |
420 | --- a/src/storage/s3.rs |
421 | +++ b/src/storage/s3.rs |
422 | @@ -18,7 +18,8 @@ |
423 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
424 | // SOFTWARE. |
425 | use async_trait::async_trait; |
426 | - use backoff::{future::FutureOperation, ExponentialBackoff}; |
427 | + use backoff::future::retry; |
428 | + use backoff::ExponentialBackoff; |
429 | use bytes::Bytes; |
430 | use derive_more::{Display, From}; |
431 | use futures::{stream, stream::TryStreamExt}; |
432 | @@ -189,18 +190,15 @@ impl<C> Backend<C> { |
433 | |
434 | // We need to retry here so that any fake S3 services have a chance to |
435 | // start up alongside Rudolfs. |
436 | - (|| { |
437 | - async { |
438 | - // Note that we don't retry certain failures, like credential or |
439 | - // missing bucket errors. These are unlikely to be transient |
440 | - // errors. |
441 | - c.head_bucket(req.clone()) |
442 | - .await |
443 | - .map_err(InitError::from) |
444 | - .map_err(InitError::into_backoff) |
445 | - } |
446 | + retry(ExponentialBackoff::default(), || async { |
447 | + // Note that we don't retry certain failures, like credential or |
448 | + // missing bucket errors. These are unlikely to be transient |
449 | + // errors. |
450 | + c.head_bucket(req.clone()) |
451 | + .await |
452 | + .map_err(InitError::from) |
453 | + .map_err(InitError::into_backoff) |
454 | }) |
455 | - .retry(ExponentialBackoff::default()) |
456 | .await?; |
457 | |
458 | log::info!("Successfully authorized with AWS"); |