about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-25 06:20:18 +0200
committerEric Wong <e@80x24.org>2021-03-25 17:58:56 +0000
commitc4012d44fda18cc36cf8cc6d2799abe2d56887c7 (patch)
tree793be06ee724ed3bf2b67aa844c057fd6fd64f9f /lib
parentd0ec7d8ddb8cb00dfb8372eaf8f5374be5e49460 (diff)
downloadpublic-inbox-c4012d44fda18cc36cf8cc6d2799abe2d56887c7.tar.gz
We need to rely on this to keep our config cache (and lei_store
pipes) under control with tests each creating a new config and
directory.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/LEI.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index e5211764..d534f1d0 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -705,6 +705,12 @@ sub _lei_cfg ($;$) {
                         File::Spec->canonpath($cfg->{'leistore.dir'})) {
                 $cfg->{-lei_store} = $sto;
         }
+        if (scalar(keys %PATH2CFG) > 5) {
+                # FIXME: use inotify/EVFILT_VNODE to detect unlinked configs
+                for my $k (keys %PATH2CFG) {
+                        delete($PATH2CFG{$k}) unless -f $k
+                }
+        }
         $self->{cfg} = $PATH2CFG{$f} = $cfg;
 }