Skip to content

Commit

Permalink
Merge pull request #799 from codeforequity-at/develop
Browse files Browse the repository at this point in the history
1.14.7
  • Loading branch information
codeforequity-at authored Mar 11, 2024
2 parents 91faae1 + ece145c commit f64d9d7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "botium-core",
"version": "1.14.6",
"version": "1.14.7",
"description": "The Selenium for Chatbots",
"main": "index.js",
"module": "dist/botium-es.js",
Expand Down
10 changes: 5 additions & 5 deletions src/containers/PluginConnectorContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = class PluginConnectorContainer extends BaseContainer {
return super.Build().then(() => promiseRetry((retry, number) => {
return (this.pluginInstance.Build ? (this.pluginInstance.Build() || Promise.resolve()) : Promise.resolve())
.catch((err) => {
if (this.retryHelperBuild.shouldRetry(err)) {
if (this.retryHelperBuild.shouldRetry(err, number)) {
debug(`Build trial #${number} failed, retry activated`)
retry(err)
} else {
Expand All @@ -65,7 +65,7 @@ module.exports = class PluginConnectorContainer extends BaseContainer {
return super.Start().then(() => promiseRetry((retry, number) => {
return (this.pluginInstance.Start ? (this.pluginInstance.Start() || Promise.resolve()) : Promise.resolve())
.catch((err) => {
if (this.retryHelperStart.shouldRetry(err)) {
if (this.retryHelperStart.shouldRetry(err, number)) {
debug(`Start trial #${number} failed, retry activated`)
retry(err)
} else {
Expand All @@ -91,7 +91,7 @@ module.exports = class PluginConnectorContainer extends BaseContainer {
return promiseRetry((retry, number) => {
return (this.pluginInstance.UserSays(mockMsg) || Promise.resolve())
.catch((err) => {
if (this.retryHelperUserSays.shouldRetry(err)) {
if (this.retryHelperUserSays.shouldRetry(err, number)) {
debug(`UserSays trial #${number} failed, retry activated`)
retry(err)
} else {
Expand All @@ -115,7 +115,7 @@ module.exports = class PluginConnectorContainer extends BaseContainer {
return super.Stop().then(() => promiseRetry((retry, number) => {
return (this.pluginInstance.Stop ? (this.pluginInstance.Stop() || Promise.resolve()) : Promise.resolve())
.catch((err) => {
if (this.retryHelperStop.shouldRetry(err)) {
if (this.retryHelperStop.shouldRetry(err, number)) {
debug(`Stop trial #${number} failed, retry activated`)
retry(err)
} else {
Expand All @@ -142,7 +142,7 @@ module.exports = class PluginConnectorContainer extends BaseContainer {
return promiseRetry((retry, number) => {
return (this.pluginInstance.Clean ? (this.pluginInstance.Clean() || Promise.resolve()) : Promise.resolve())
.catch((err) => {
if (this.retryHelperClean.shouldRetry(err)) {
if (this.retryHelperClean.shouldRetry(err, number)) {
debug(`Clean trial #${number} failed, retry activated`)
retry(err)
} else {
Expand Down
4 changes: 3 additions & 1 deletion src/helpers/RetryHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ module.exports = class RetryHelper {
}
}

shouldRetry (err) {
shouldRetry (err, currentRetryCount) {
if (!err) return false
if (!this.retrySettings.retries) return false
if (this.retrySettings.retries < currentRetryCount) return false
if (this.retryErrorPatterns.length === 0) return true
const errString = util.inspect(err)
for (const re of this.retryErrorPatterns) {
Expand Down
4 changes: 2 additions & 2 deletions src/scripting/ScriptingProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const p = (retryHelper, fn) => {
if (retryHelper) {
return promiseRetry((retry, number) => {
return promise().catch(err => {
if (retryHelper.shouldRetry(err)) {
if (retryHelper.shouldRetry(err, number)) {
debug(`Asserter trial #${number} failed, retry activated`)
retry(err)
} else {
Expand All @@ -62,7 +62,7 @@ const pnot = (retryHelper, fn, errTemplate) => {
if (retryHelper) {
return promiseRetry((retry, number) => {
return promise().catch(() => {
if (retryHelper.shouldRetry(errTemplate)) {
if (retryHelper.shouldRetry(errTemplate, number)) {
debug(`Asserter trial #${number} failed, !retry activated`)
retry(errTemplate)
} else {
Expand Down

0 comments on commit f64d9d7

Please sign in to comment.