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

Background jobs #5259

Merged
merged 5 commits into from Dec 2, 2019
Merged

Background jobs #5259

merged 5 commits into from Dec 2, 2019

Commits on Nov 30, 2019

  1. Shutdown background job on error

    When running a main method, if the user inputs ctrl+c then the `run`
    task will exit but the main method is not interrupted so it continues
    running even once sbt has returned to the shell. If the main method is a
    webserver, this prevents run from ever starting again on a fixed port.
    To fix this, we can modify the waitForTry method to stop the job if an
    exception is thrown (ctrl+c leads to an interrupted exception being
    thrown by waitFor).
    
    I rework the BackgroundJobService so that the default implementation of
    waitForTry is now usable and no longer needs to be overridden. The side
    effect of this change is that waitFor may now throw an exception. Within
    sbt, waitFor was only used in one place and I reworked it to use
    waitForTry instead. This could theoretically break a downstream user who
    relied on waitFor not throwing an exception but I suspect that there
    aren't many users of this api, if any at all.
    eatkins committed Nov 30, 2019
    Configuration menu
    Copy the full SHA
    8d26bc7 View commit details
    Browse the repository at this point in the history
  2. Fix background job shutdown

    When a user calls sbt exit and there is an active background job, sbt
    may not exit cleanly. This was primarily because the
    background job service shutdown method depended on the
    StandardMain.executionContext which was closed before the background job
    service was shutdown. This was fixable by reordering the resource
    closing in StandardMain.runManaged.
    eatkins committed Nov 30, 2019
    Configuration menu
    Copy the full SHA
    7426ae5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    73edc8d View commit details
    Browse the repository at this point in the history
  4. Move background job service directory location

    Rather than putting the background job temporary files in whatever
    java.io.tmpdir points to, this commit moves the files into a
    subdirectory of target in the project root directory.
    
    To make the directory configurable via settings, I had to move the
    declaration of the bgJobService setting later in the project
    initialization process. I don't think this should matter because
    background jobs shouldn't be created until after the project has loaded
    all of its settings..
    eatkins committed Nov 30, 2019
    Configuration menu
    Copy the full SHA
    73a1967 View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2019

  1. Configuration menu
    Copy the full SHA
    abb3f61 View commit details
    Browse the repository at this point in the history