Skip to content

Commit

Permalink
fix(runner): replace enum runner status with basic string type
Browse files Browse the repository at this point in the history
  • Loading branch information
brewcoua committed Jun 14, 2024
1 parent 9448613 commit f0b735f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/services/runner/Runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class Runner extends Service {
}
private readonly actions: Action[] = []

private _status: RunnerStatus = RunnerStatus.Starting
private _status: RunnerStatus = 'starting'
public get status(): RunnerStatus {
return this._status
}
Expand All @@ -50,7 +50,7 @@ export default class Runner extends Service {
public async run(): Promise<TaskResult> {
this.logger.debug(`Starting task: ${this.task}`)

this.status = RunnerStatus.Running
this.status = 'running'

while (
this.cycles.total < config.cycles.max &&
Expand All @@ -69,8 +69,8 @@ export default class Runner extends Service {
if (action.type === ActionType.Done) {
this.status =
action.arguments.status === 'success'
? RunnerStatus.Done
: RunnerStatus.Failed
? 'done'
: 'failed'

return {
success: action.arguments.status === 'success',
Expand All @@ -83,7 +83,7 @@ export default class Runner extends Service {
if (config.delay) await this.sleep(config.delay)
}

this.status = RunnerStatus.Failed
this.status = 'failed'

if (this.cycles.failed >= config.cycles.failed) {
return {
Expand Down
7 changes: 1 addition & 6 deletions src/services/runner/domain/RunnerStatus.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
export enum RunnerStatus {
Starting = 'Starting',
Running = 'Running',
Done = 'Done',
Failed = 'Failed',
}
export type RunnerStatus = 'starting' | 'running' | 'done' | 'failed'
export default RunnerStatus

0 comments on commit f0b735f

Please sign in to comment.