Closed ViceEye closed 9 months ago
I have the exact same problem. I'm now up to 5 processes that will reload and 4 of them give error due to my api port is already in use.
Have anyone else had this and solved it?
Same here. ChatGPT told me to implement graceful shutdown but it didn't work. There is a high chance that I implemented it wrong, but the know-it-all chatGPT gave me the approval
same here... I was tinking that visual studio code is saving file multiple times but, also with notepad is the same... I think that air should verify if a build is on-going and not start more builds at the same time...
Try to change the .air.toml with the following values:
kill_delay = "10s" delay = 500
It should work.
It should work.
Unfortunately, not quite, I did that, it worked for me only on first time, but will fail eventually:
__ _ ___
/ /\ | | | |_)
/_/--\ |_| |_| \_ , built with Go 1.21.0
watching .
!exclude tmp
building...
running...
2023/09/07 16:48:36 Listening on :8080...
main.go has changed
building...
main.go has changed
running...
2023/09/07 16:48:55 Listening on :8080...
main.go has changed
building...
main.go has changed
building...
running...
running...
2023/09/07 16:49:44 Listening on :8080...
2023/09/07 16:49:44 Listening on :8080...
2023/09/07 16:49:44 ListenAndServe: listen tcp :8080: bind: address already in use
IE, at 16:48:36
air detect changes twice, and survived, but after 16:48:55
air detected changes again, but this time multiple buildRuns will run simultaneously.
I think the root cause is to fix why there are multiple instances running simultaneously.
Just got into go and air, and this happened to me aswell, logs (http example):
__ _ ___
/ /\ | | | |_)
/_/--\ |_| |_| \_ , built with Go
watching .
!exclude tmp
building...
running...
main.go has changed
building...
main.go has changed
running...
main.go has changed
main.go has changed
building...
building...
running...
running...
2023/09/20 18:07:30 listen tcp :8080: bind: address already in use
main.go has changed
building...
main.go has changed
building...
running...
running...
2023/09/20 18:07:36 listen tcp :8080: bind: address already in use
Code changes under ./cmd are not detected and not reloading
and cd to
./cmd
and runair
with config under./cmd
then it will work, tried changeroot = "."
toroot = "./cmd"
but still not detecting changes