about summary refs log tree commit homepage
path: root/script
diff options
authorEric Wong <e@80x24.org>2017-06-24 07:33:44 +0000
committerEric Wong <e@80x24.org>2017-06-26 03:44:30 +0000
commitf9b70eb6ebbf96c2fe79ab2738ea4954c5a124f3 (patch)
tree4f5785aa3252bbf4330c385f652926e48103dc42 /script
parentd9c9dc5af637e097d545a828d887aae99ddcd2a7 (diff)
We need to ensure new messages are being processed
fairly during full rescans, so have the ->scan subroutine
yield and reschedule itself.  Additionally, having a
long-running task inside the signal handler is dangerous
and subject to reentrancy bugs.

Due to the limitations of the Filesys::Notify::Simple interface,
we cannot rely on multiplexing I/O interfaces (select, IO::Poll,
Danga::Socket, etc...) for this.  Forking a separate process
was considered, but it is more expensive for a mostly-idle

So, we use a variant of the "self-pipe trick" via inotify (or
whatever Filesys::Notify::Simple gives us).  Instead of writing
to our own pipe, we write to a file in our own temporary
directory watched by Filesys::Notify::Simple to trigger events
in signal handlers.
Diffstat (limited to 'script')
1 files changed, 1 insertions, 1 deletions
diff --git a/script/public-inbox-watch b/script/public-inbox-watch
index a72180c9..51f1baa2 100755
--- a/script/public-inbox-watch
+++ b/script/public-inbox-watch
@@ -13,7 +13,7 @@ my $reload = sub {
 if ($watch_md) {
-        my $scan = sub { $watch_md->scan if $watch_md };
+        my $scan = sub { $watch_md->trigger_scan('full') if $watch_md };
         $SIG{HUP} = $reload;
         $SIG{USR1} = $scan;
         $SIG{ALRM} = sub { $SIG{ALRM} = 'DEFAULT'; $scan->() };