Closed rushmorem closed 6 years ago
That should happen anyway without the pkill; if it doesn't it's a (watchexec) bug. Restarting servers has always been possible.
Catflap has a different purpose: it offers a socket that's already open and remains open even if you stop listening on it. That way, you don't drop packets and you avoid port availability errors. It's a lot like reloading nginx or apache, for production examples: restart and you'll have downtime, reload and you won't.
That should happen anyway without the pkill; if it doesn't it's a (watchexec) bug. Restarting servers has always been possible.
With certain apps, like actix-web
, cargo watch -x run
runs into ADDR_IN_USE
. Hence using pkill
to kill the process before restarting.
That way, you don't drop packets and you avoid port availability errors
Ah, I see. All this looked to me like it was for avoiding port availability errors and only needed in development.
ADDR_IN_USE
is because the server restarts too quickly, not because it's not killed. (Or because the server is starting sub-processes some weird way and we can't kill those easily, see the "this could be a bug" thing.) There's a delay in between releasing a socket and the socket actually being reaped. ADDR_IN_USE
is exactly what I mean by "port availability" issues.
ADDR_IN_USE
is exactly what I mean by "port availability" issues.
Yeah, I know. I thought that was the only use for catflap
. Since using pkill
helps avoid that port availability issue without modifying my apps, I thought catflap
wasn't necessary. I was misinformed.
That's alright :) Thank you for asking in anyway! I might clarify the Readme in this regard later
Besides using
catflap
, one can simply kill the process using thepkill
command before restarting the server like thisThis way, you don't have to alter your server.