kiwix / kiwix-tools

Command line Kiwix tools: kiwix-serve, kiwix-manage, ...
https://download.kiwix.org/release/kiwix-tools/
GNU General Public License v3.0
433 stars 85 forks source link

kiwix-serve can monitor and reload the library automatically #503

Closed veloman-yunkan closed 2 years ago

veloman-yunkan commented 2 years ago

Fixes #476

If started with the --monitorLibrary option (or its short variant -M) kiwix-serve monitors the input library files and reloads the library automatically.

Only the timestamp of the library file(s) is monitored (if there are multiple library files the most recently modified file's timestamp is used). The library is reloaded when the monitored timestamp grows.

SIGHUP makes kiwix-serve to reload the library unconditionally (even if the file hasn't changed).

kelson42 commented 2 years ago

@veloman-yunkan Thx for the PR. What does your last comment means regarding Windows? iMO It shoukd works the same whatever the platform.

It should be optional as well, something like —monitorLibrary.

veloman-yunkan commented 2 years ago

@veloman-yunkan Thx for the PR. What does your last comment means regarding Windows? iMO It shoukd works the same whatever the platform.

It should be optional as well, something like —monitorLibrary.

@kelson42 I included the fix in the Windows build too (but didn't test it). I also added the --monitorLibrary option.

Note that the support for reloading the library on SIGHUP was dropped. Should I restore it?

kelson42 commented 2 years ago

Note that the support for reloading the library on SIGHUP was dropped. Should I restore it?

Thx for your quick move based on my comment. Sounds good.

Hmmm, yes definitly... I don't really understand why this has been dropped, we just introduced it!

From a general point of view (kind of mine):

veloman-yunkan commented 2 years ago

Note that the support for reloading the library on SIGHUP was dropped. Should I restore it?

Hmmm, yes definitly... I don't really understand why this has been dropped, we just introduced it!

@kelson42 I thought that forced library reloading on SIGHUP was a temporary solution until automatic reloading is implemented. I will restore it shortly.

kelson42 commented 2 years ago

Note that the support for reloading the library on SIGHUP was dropped. Should I restore it?

Hmmm, yes definitly... I don't really understand why this has been dropped, we just introduced it!

@kelson42 I thought that forced library reloading on SIGHUP was a temporary solution until automatic reloading is implemented. I will restore it shortly.

OK. No, it is an alternative.

veloman-yunkan commented 2 years ago

@kelson42 Handling of SIGHUP is restored. The PR seems to be final (pending only review by @mgautierfr).