generateRandomString,
isTestInstance,
getFormatedObjects,
+ retryWrapper,
transactionRetryer
}
}
}
+// { arguments, errorMessage }
+function retryWrapper (functionToRetry, options, finalCallback) {
+ const args = options.arguments ? options.arguments : []
+
+ utils.transactionRetryer(
+ function (callback) {
+ return functionToRetry.apply(this, args.concat([ callback ]))
+ },
+ function (err) {
+ if (err) {
+ logger.error(options.errorMessage, { error: err })
+ }
+
+ // Do not return the error, continue the process
+ return finalCallback(null)
+ }
+ )
+}
+
function transactionRetryer (func, callback) {
retry({
times: 5,