Skip to content

Commit

Permalink
fixed refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
DavertMik committed Jan 12, 2025
1 parent 52d91f4 commit 7703147
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
9 changes: 0 additions & 9 deletions lib/step/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,3 @@ class Step {
}

module.exports = Step

function dryRunResolver() {
return {
get(target, prop) {
if (prop === 'toString') return () => '<VALUE>'
return new Proxy({}, dryRunResolver())
},
}
}
4 changes: 2 additions & 2 deletions lib/step/meta.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const Step = require('../step')
const Step = require('./base')
const event = require('../event')
const { humanizeString } = require('../utils')

class MetaStep extends Step {
constructor(obj, method) {
if (!method) method = ''
super(null, method)
super(method)
this.actor = obj
}

Expand Down
9 changes: 1 addition & 8 deletions lib/step/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const recorder = require('../recorder')
const StepConfig = require('./config')
const store = require('../store')
const { TIMEOUT_ORDER } = require('./timeout')

const retryStep = require('./retry')
function recordStep(step, args) {
step.status = 'queued'

Expand Down Expand Up @@ -67,10 +67,3 @@ function recordStep(step, args) {
}

module.exports = recordStep

function retryStep(opts) {
if (opts === undefined) opts = 1
recorder.retry(opts)
// remove retry once the step passed
recorder.add(() => event.dispatcher.once(event.step.finished, () => recorder.retries.pop()))
}
11 changes: 11 additions & 0 deletions lib/step/retry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const recorder = require('../recorder')
const event = require('../event')

function retryStep(opts) {
if (opts === undefined) opts = 1
recorder.retry(opts)
// remove retry once the step passed
recorder.add(() => event.dispatcher.once(event.step.finished, () => recorder.retries.pop()))
}

module.exports = retryStep

0 comments on commit 7703147

Please sign in to comment.