Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F31822821
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
Krinkle
May 16 2020, 10:56 PM
2020-05-16 22:56:14 (UTC+0)
Size
664 B
Referenced Files
None
Subscribers
None
raw.txt
View Options
from __future__ import print_function
import os
import time
import redis
red = redis.StrictRedis(password=os.environ['AUTH'])
query_key_pattern = '*:echo:seen:*'
cond_key = ':echo:seen:'
cond_ttl=-1
# cond_value='s:14:"19700101000001";'
checked = 0
printed = 0
deleted = 0
for key in red.scan_iter(match=query_key_pattern, count=1000):
if not cond_key in key:
# sanity
print('F', end='')
continue
checked += 1
if checked > 1000:
# idle for 100ms
time.sleep(0.100)
checked = 0
if red.ttl(key) == cond_ttl:
red.delete(key)
deleted += 1
printed += 1
if (printed > 80):
print('.. deleted ' + str(deleted) + ' sofar')
printed = 0
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8407226
Default Alt Text
raw.txt (664 B)
Attached To
Mode
P11211 Prune stale Echo keys from Redis main stash
Attached
Detach File
Event Timeline
Log In to Comment