Skip to content

Comment on Graceful server restart with Go

Comments

You can just use systemd for this. Open the FD in systemd and then pass it into the process.

The less I rely on the operating system environment, the best it is. Go provides static binaries, easy to deploy. I don't want to get hooked to systemd. (even more if my server can handle the use case with a few lines of code.)

Notice how the discussion is full of edge-cases which this code doesn't handle? That's the argument for letting the operating system handle it unless this is such a key part of what you do that it's worth taking on that expense personally.

Notice how the discussion is full of edge-cases which this code doesn't handle?

Can you point to a single unhandled edge case mentioned so far in this discussion? The only possible one I see is finnh's complaint that it doesn't support changing arguments, but that seems more like a missing feature (which doesn't seem that important to me) than an edge case.

The logic needed to correctly implement this is quite minimal, and implementing it yourself both spares you a rather heavy dependency and gives you more flexibility.

For the argument, you can change them, i answered there:

https://news.ycombinator.com/item?id=8773176

So far, I haven't encountered any annoying edge case I can't handle, so if you have examples, I'll be glad to discuss them with you

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.