Canop / Canop/bacon

feature: Reducing the downtime of a long-running process

Open
#387 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.4k
Forks
126
Avg merge
2d 1h
Merged PRs (30d)
7

Description

Hi, I work on a web application written in Rust.
I use bacon as a watcher to restart automatically the backend server whenever I make a change. Here’s my current `bacon.toml` file:

```toml
default_job = "check"

[jobs.check]
command = ["cargo", "check"]
need_stdout = false

[jobs.run]
command = [
"cargo", "run", "server"
]
need_stdout = true
allow_warnings = true
background = false
on_change_strategy = "kill_then_restart"
watch = ["templates/"]
```

Compiling my project takes about 5s. When I edit an HTML file in the `templates` directory (these files are embedded in the rust binary using [askama](https://askama.readthedocs.io/en/stable/)) and save it, `bacon` triggers a rebuild and restart. The process looks like this:

Image


I’d like to reduce the downtime of my Rust binary during this process. Ideally, it would work more [like this](https://excalidraw.com/#json=WLHl4Y6abXyxRmkPhsMZ9,mGweupzet9ZJjdVRV38HRw):

Image

I tried using the `wait_and_restart` strategy, but the server never restarts. I’m not very familiar with bacon, so I might be missing something in the configuration.

Any help would be appreciated!
Thanks in advance.

Contributor guide

Open the contributing guide

Research direction

Start with the bacon.toml configuration and compare the current kill_then_restart behavior with the attempted wait_and_restart strategy. Reproduce the workflow using the templates/ watch path and cargo run server command, then trace how the process lifecycle is handled. Done means template changes trigger a restart with less downtime and the server does not remain stopped.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.