flickr-cli
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "flickr-cli", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "command line interface for flickr", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,1 +1,5 @@ | ||
const {RetryPolicies, Retry} = require("../utils/retry"); | ||
const retry = new Retry(5, 1000, RetryPolicies.exponential); | ||
const upload = async (params, config, flickr) => { | ||
@@ -5,3 +9,3 @@ for (const file of params.files) { | ||
try { | ||
const res = await flickr.upload(file); | ||
const res = await retry.retry(async () => await flickr.upload(file)); | ||
process.stdout.write(` OK - photoid: ${res.photoid._content}\n`); | ||
@@ -11,3 +15,3 @@ } | ||
{ | ||
console.error(error); | ||
console.error(`Failed to upload ${file}: ${error.message}`); | ||
} | ||
@@ -14,0 +18,0 @@ } |
@@ -18,2 +18,13 @@ const td = require("testdouble"); | ||
}); | ||
it("should retry 5 times", async function () { | ||
this.timeout(16000); | ||
const flickr = td.object(["upload"]); | ||
const file = "ljhkjh"; | ||
td.when(flickr.upload(file)).thenReject(Error("bla")); | ||
await upload({files: [file]}, {}, flickr); | ||
td.verify(flickr.upload(file), {times: 5}); | ||
}); | ||
}); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14912
15
369
1