[Koha-devel] Restart plack when needed
Jonathan Druart
jonathan.druart at bugs.koha-community.org
Fri Sep 9 16:32:14 CEST 2016
Hi devs,
A couple days ago I found that the --reload option of plackup causes
a high CPU load (around 35%). If I remove it, the process is around 1%
(when sleeping).
So I have tried inotify2 (Linux::Inotify2) to add watchers and restart
plack when a file is changed.
But 1/ It's not recursive and I will have to script without knowing
the perf impacts and 2/ It will be terrible when checking out another
git branch (1 restart per file changed!).
After a talk with a friend, I decided to use a git hook and map a key
in my vim config to do so:
The git hook:
.git/hooks/post-checkout
#!/bin/sh
exec /usr/local/bin/restart_plack
exit 0
The vim map command:
map <F2> <Esc>:w<CR>:!(/usr/local/bin/restart_plack > /dev/null 2>&1)&<CR>a
And that's all :)
To be complete, here is my restart_plack script: http://pastebin.com/8wFSC4fJ
Cheers,
Jonathan
More information about the Koha-devel
mailing list