etix / mirrorbits

Mirrorbits is a geographical download redirector written in Go for distributing files efficiently across a set of mirrors.
MIT License
497 stars 90 forks source link

Reload logs on SIGHUP, in case the LogDir option was modified #143

Closed elboulangero closed 3 months ago

elboulangero commented 8 months ago

Here's the issue: if ever the LogDir option is modified in the configuration file, sending SIGHUP is not enough to make the change effective, and mirrorbits keep using the old LogDir value. In other words: the LogDir config option is not reloaded on SIGHUP.

How to reproduce: say you have mirrorbits running, and LogDir is commented out. It means mirrorbits doesn't log downloads under the file $LogDir/downloads.log. Now, edit the configuration, uncomment LogDir, send SIGHUP to mirrorbits, and observe that it has no effect: there is still no file $LogDir/downloads.log.

I consider it a bug, even though a minor one, just a papercut.

This commit fixes it by always reloading the logs on SIGHUP, thus making sure that, if ever LogDir was modified, the change is taken into account.

elboulangero commented 3 months ago

@jbkempf Is this MR Ok with you? It's pretty trivial but I didn't receive any feedback so far.

I reworded the commit message, trying to make it clearer. If there's something unclear or obviously wrong with this commit, please say. Thanks!

elboulangero commented 3 months ago

Thanks!