]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/InboxIdle.pm
inboxidle: clue users into resolving ENOSPC from inotify
[public-inbox.git] / lib / PublicInbox / InboxIdle.pm
index bdb30284ac09b77b5bba5195514abc5458bada36..357bd216b5c30642fef65c84bbd343053d53ec25 100644 (file)
@@ -41,8 +41,16 @@ sub in2_arm ($$) { # PublicInbox::Config::each_inbox callback
        $cur->[0] = $ibx;
 
        my $lock = "$dir/".($ibx->version >= 2 ? 'inbox.lock' : 'ssoma.lock');
-       my $w = $cur->[1] = $inot->watch($lock, $IN_MODIFY);
-       $self->{on_unlock}->{$w->name} = $ibx;
+       if (my $w = $cur->[1] = $inot->watch($lock, $IN_MODIFY)) {
+               $self->{on_unlock}->{$w->name} = $ibx;
+       } else {
+               warn "E: ".ref($inot)."->watch($lock, IN_MODIFY) failed: $!\n";
+               if ($!{ENOSPC} && $^O eq 'linux') {
+                       warn <<"";
+I: consider increasing /proc/sys/fs/inotify/max_user_watches
+
+               }
+       }
 
        # TODO: detect deleted packs (and possibly other files)
 }