Skip to content

Commit 8cb19f8

Browse files
committed
Make purgehook aware of files in data/ and issue xkey purges
For any changes to files in data/, issues an xkey purge of data_<filename_without_extension>. This allows us to automatically purge out data based on changes to data files in the git repository.
1 parent 43f6f30 commit 8cb19f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/purgehook/purgehook.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,10 @@
4747
curs.execute("SELECT varnish_purge('^/' || %(u)s || '$')", {
4848
'u': l.strip(),
4949
})
50+
elif l.startswith('data/'):
51+
# Data files map to xkeys with the same name as the file prefixed by data_
52+
curs.execute("SELECT varnish_purge_xkey(%(key)s)", {
53+
'key': 'data_{}'.format(os.path.splitext(os.path.basename(l))[0]),
54+
})
5055
conn.commit()
5156
conn.close()

0 commit comments

Comments
 (0)