1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

don'tremove range if has end (for now)

remove completed urls
This commit is contained in:
Ilya Kreymer 2023-05-07 13:15:38 -07:00
parent c4bbda90ff
commit e8671fbb37
2 changed files with 5 additions and 6 deletions

View File

@ -248,8 +248,8 @@ class RewriterApp(object):
range_start = start
range_end = end
# if start with 0, load from upstream, but add range after
if start == 0:
# if start with 0 and no end, load from upstream
if start == 0 and not end:
del inputreq.env['HTTP_RANGE']
else:
skip_record = True

View File

@ -108,7 +108,7 @@ class WritableRedisIndexer(RedisIndexSource):
class RedisPendingCounterTempBuffer(tempfile.SpooledTemporaryFile):
def __init__(self, max_size, redis_url, params, name, timeout=30):
redis_url = res_template(redis_url, params)
super(RedisPendingCounterTempBuffer, self).__init__(max_size=max_size)
super(RedisPendingCounterTempBuffer, self).__init__(max_size=max_size, dir="./")
self.redis, self.key = RedisIndexSource.parse_redis_url(redis_url)
self.map_key = self.key + ':h'
self.timeout = timeout
@ -119,8 +119,6 @@ class RedisPendingCounterTempBuffer(tempfile.SpooledTemporaryFile):
self.url = params.get('url')
self.redis.hincrby(self.map_key, self.url, 1)
print(params)
def write(self, buf):
super(RedisPendingCounterTempBuffer, self).write(buf)
self.redis.expire(self.key, self.timeout)
@ -133,5 +131,6 @@ class RedisPendingCounterTempBuffer(tempfile.SpooledTemporaryFile):
self.redis.incrby(self.key, -1)
self.redis.expire(self.key, self.timeout)
self.redis.hincrby(self.map_key, self.url, -1)
if not self.redis.hincrby(self.map_key, self.url, -1):
self.redis.hdel(self.map_key, self.url)