Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Dec 6, 2021

Conversation

veloman-yunkan
Copy link
Collaborator

@veloman-yunkan veloman-yunkan commented Dec 4, 2021

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
Copy link
Contributor

kelson42 commented Dec 5, 2021

@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 veloman-yunkan force-pushed the automatic_library_reloading branch 3 times, most recently from 8897c71 to 2886e7b Compare December 5, 2021 14:30
@veloman-yunkan
Copy link
Collaborator Author

@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?

@veloman-yunkan veloman-yunkan changed the title kiwix-serve reloads the library automatically kiwix-serve monitors and reloads the library automatically Dec 5, 2021
@kelson42
Copy link
Contributor

kelson42 commented Dec 5, 2021

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):

  • The SIGHUP is the POSIX solution for systems run by IT people, where kiwix-serve is part of a more complex infrastructure.
  • This ticket/PR is a kind of alternative feature but for people which don't want or can explicitly deal with signals.

@veloman-yunkan
Copy link
Collaborator Author

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
Copy link
Contributor

kelson42 commented Dec 5, 2021

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 veloman-yunkan changed the title kiwix-serve monitors and reloads the library automatically kiwix-serve can monitor and reload the library automatically Dec 5, 2021
@veloman-yunkan
Copy link
Collaborator Author

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

Copy link
Member

@mgautierfr mgautierfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mgautierfr mgautierfr merged commit 32432a7 into master Dec 6, 2021
@mgautierfr mgautierfr deleted the automatic_library_reloading branch December 6, 2021 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kiwix-serve should reload automatically content (library/files) if files change
3 participants