Merge pull request #991 from SkynetLabs/fix-airtable-blocking-in-background

do not try to run interactive docker exec
This commit is contained in:
Christopher Schinnerl 2021-07-23 16:51:50 +02:00 committed by GitHub
commit 45606f657d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -100,11 +100,11 @@ async def block_skylinks_from_airtable():
batch_size = 1000
for i in range(0, len(skylinks), batch_size):
cached_files_command = (
"find /data/nginx/cache/ -type f | xargs --no-run-if-empty -n" + str(batch_size) + " grep -Els '^Skynet-Skylink: ("
"find /data/nginx/cache/ -type f | xargs -r grep -Els '^Skynet-Skylink: ("
+ "|".join(skylinks[i:i+batch_size])
+ ")'"
)
cached_files_count+= int(exec('docker exec -it nginx bash -c "' + cached_files_command + ' | xargs -r rm -v | wc -l"'))
cached_files_count+= int(exec('docker exec nginx bash -c "' + cached_files_command + ' | xargs -r rm -v | wc -l"'))
if cached_files_count == 0:
return print("No nginx cached files matching blocked skylinks were found")