]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei note-event: clear_src on ENOENT
authorEric Wong <e@80x24.org>
Thu, 21 Oct 2021 21:10:28 +0000 (21:10 +0000)
committerEric Wong <e@80x24.org>
Fri, 22 Oct 2021 00:54:47 +0000 (00:54 +0000)
When a file goes away, try to make sure we don't waste
time trying to access or store it.

lib/PublicInbox/LeiNoteEvent.pm

index 3472e73070d6e86c9fe4f57b87b37db1c7d13be4..22d6ffac9feb7e4cfabbb96d88542a58fc61ae30 100644 (file)
@@ -8,6 +8,7 @@ use strict;
 use v5.10.1;
 use parent qw(PublicInbox::IPC);
 use PublicInbox::DS;
 use v5.10.1;
 use parent qw(PublicInbox::IPC);
 use PublicInbox::DS;
+use Errno qw(ENOENT);
 
 our $to_flush; # { cfgpath => $lei }
 
 
 our $to_flush; # { cfgpath => $lei }
 
@@ -59,8 +60,11 @@ sub eml_event ($$$$) {
 
 sub maildir_event { # via wq_io_do
        my ($self, $fn, $vmd, $state) = @_;
 
 sub maildir_event { # via wq_io_do
        my ($self, $fn, $vmd, $state) = @_;
-       my $eml = PublicInbox::InboxWritable::eml_from_path($fn) // return;
-       eml_event($self, $eml, $vmd, $state);
+       if (my $eml = PublicInbox::InboxWritable::eml_from_path($fn)) {
+               eml_event($self, $eml, $vmd, $state);
+       } elsif ($! == ENOENT) {
+               $self->{lms}->clear_src(@{$vmd->{sync_info}});
+       } # else: eml_from_path already warns
 }
 
 sub lei_note_event {
 }
 
 sub lei_note_event {