From c4012d44fda18cc36cf8cc6d2799abe2d56887c7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 25 Mar 2021 06:20:18 +0200 Subject: lei: janky $PATH2CFG garbage collection 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. --- lib/PublicInbox/LEI.pm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') 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; } -- cgit v1.2.3-24-ge0c7