From 8cb19f882d72487e944d7188fdebc13a99f7e323 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Wed, 13 Aug 2025 09:59:24 +0200 Subject: [PATCH] Make purgehook aware of files in data/ and issue xkey purges For any changes to files in data/, issues an xkey purge of data_. This allows us to automatically purge out data based on changes to data files in the git repository. --- tools/purgehook/purgehook.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/purgehook/purgehook.py b/tools/purgehook/purgehook.py index 3102a94f..35e2127e 100755 --- a/tools/purgehook/purgehook.py +++ b/tools/purgehook/purgehook.py @@ -47,5 +47,10 @@ if __name__ == "__main__": curs.execute("SELECT varnish_purge('^/' || %(u)s || '$')", { 'u': l.strip(), }) + elif l.startswith('data/'): + # Data files map to xkeys with the same name as the file prefixed by data_ + curs.execute("SELECT varnish_purge_xkey(%(key)s)", { + 'key': 'data_{}'.format(os.path.splitext(os.path.basename(l))[0]), + }) conn.commit() conn.close() -- 2.39.5