Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace job#succeeded/failed/executed with an enum #79

Closed
robacarp opened this issue Jan 18, 2022 · 0 comments · Fixed by #104
Closed

Replace job#succeeded/failed/executed with an enum #79

robacarp opened this issue Jan 18, 2022 · 0 comments · Fixed by #104

Comments

@robacarp
Copy link
Collaborator

In several places the logic which determines the state of a job is getting complicated because the sate is held in several places. It would probably improve readability to combine #executed? #succeeded? and #failed? under an Enum:

    def run
      before_hook

      raise DoubleRun.new if executed
      @state = State::Running
      perform
    rescue JobFailed
      @state = State::Failed
    rescue e : DoubleRun
      raise e
    rescue e
      log "Job failed! Raised #{e.class}: #{e.message}"
      e.backtrace.each do |trace|
        log trace
      end

      @state = State::Failed
    else
      @state = State::Succeeded
    end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant