Skip to content

Commit 92fe174

Browse files
committed
enh: improve garbage collection logic and increase sleep duration
1 parent d10f165 commit 92fe174

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

proxy_log.py

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def garbage(self):
110110
if time.time() - os.path.getmtime(file_path) > time_limit:
111111
os.remove(file_path)
112112
counter = counter + 1
113+
if counter == 0:
114+
return
113115
print(f'Garbage collected {counter} files')
114116

115117
def _gen_path(self, content_hash: str) -> str:

proxy_server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async def storage_garbage_task(app):
8686
content_storage: ContentStorage = app.get('proxy_log').get_content_storage()
8787
while True:
8888
content_storage.garbage()
89-
await asyncio.sleep(60)
89+
await asyncio.sleep(600)
9090

9191

9292
def run_proxy_server(environment: Environment, proxy_log: ProxyLog):

0 commit comments

Comments
 (0)