From ea8ccba3fa932ae4b1837357b76036f8a26d2dea Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Mon, 1 Mar 2021 18:26:38 +0100 Subject: [PATCH] print cached files --- setup-scripts/blocklist-airtable.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/setup-scripts/blocklist-airtable.py b/setup-scripts/blocklist-airtable.py index 088b371a..fa00ab86 100755 --- a/setup-scripts/blocklist-airtable.py +++ b/setup-scripts/blocklist-airtable.py @@ -43,12 +43,10 @@ async def block_skylinks_from_airtable(): message = "Siad blocklist endpoint responded with code " + str(response.status_code) + ": " + (response.text or "empty response") return await print(message) or send_msg(client, message, force_notify=True) - print("Clearing nginx cache related to blocked skylinks") - find_all_cache_files = '/usr/bin/find /data/nginx/cache/ -type f' - grep_pattern = '\'^KEY: .*(' + '|'.join(skylinks) + ')\'' - filter_matching_files = '/usr/bin/xargs --no-run-if-empty -n1000 /bin/grep -El ' + grep_pattern - print('docker exec -it nginx bash -c "' + find_all_cache_files + ' | ' + filter_matching_files + '"') - os.popen('docker exec -it nginx bash -c "' + find_all_cache_files + ' | ' + filter_matching_files + '"') + print("Purging nginx cache containing blocked skylinks") + purge_command = '/usr/bin/find /data/nginx/cache/ -type f | /usr/bin/xargs --no-run-if-empty -n1000 /bin/grep -El \'^KEY: .*(' + '|'.join(skylinks) + ')\'' + cached_files = os.popen('docker exec -it nginx bash -c "' + purge_command + '"').read().strip() + print(cached_files) async def exit_after(delay): await asyncio.sleep(delay)