From: Eric Wong Date: Thu, 25 Mar 2021 04:20:18 +0000 (+0200) Subject: lei: janky $PATH2CFG garbage collection X-Git-Tag: v1.7.0~911 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c4012d44fda18cc36cf8cc6d2799abe2d56887c7;p=public-inbox.git 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. --- 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; }