diff options
author | Eric Wong <e@80x24.org> | 2017-06-24 07:33:44 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-06-26 03:44:30 +0000 |
commit | f9b70eb6ebbf96c2fe79ab2738ea4954c5a124f3 (patch) | |
tree | 4f5785aa3252bbf4330c385f652926e48103dc42 /script/public-inbox-watch | |
parent | d9c9dc5af637e097d545a828d887aae99ddcd2a7 (diff) | |
download | public-inbox-f9b70eb6ebbf96c2fe79ab2738ea4954c5a124f3.tar.gz |
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 process. 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/public-inbox-watch')
-rwxr-xr-x | script/public-inbox-watch | 2 |
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 { }; $reload->(); 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->() }; |