air.toml interrupts and kill_delay

Mon, Nov 27, 2023 One-minute read

air.toml interrupts and kill_delay

TIL that you can make air send system interrupt to the process when it reloads and have a waiting period.

This is really important for long running or async tasks which need to complete. e.g. sending a notification then writing to the DB.

# full air.toml for completeness.
root = "."
tmp_dir = "tmp"

[build]
bin = "./tmp/app serve"
cmd = "go build -o ./tmp/app ./cmd/app"
delay = 1000
exclude_dir = ["node_modules", "tmp", "vendor"]
exclude_file = []
exclude_regex = []
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html", "css", "js"]
kill_delay = "2s" # here
send_interrupt = true # here
stop_on_error = true
log = "build-errors.log"

[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"

[log]
time = false

[misc]
clean_on_exit = false

Tags:

#TIL