From: Magnus Hagander Date: Wed, 13 Aug 2025 07:59:24 +0000 (+0200) Subject: Make purgehook aware of files in data/ and issue xkey purges X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=8cb19f882d72487e944d7188fdebc13a99f7e323;p=pgweb.git 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. --- 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()