Fix ready probe, nested target folders
Fixed a minor mistake in reference used for readyness queue When creating the linked file on disk, subfolder are created first if needed
This commit is contained in:
+1
-1
@@ -35,6 +35,6 @@ async def startup(request):
|
||||
@ps.routes.get("/ready")
|
||||
async def ready(request):
|
||||
current_queue = ps.prompt_queue.get_current_queue()
|
||||
if len(ps[0]) == 0 and len(ps[1]) == 0:
|
||||
if len(current_queue[0]) == 0 and len(current_queue[1]) == 0:
|
||||
return web.json_response(current_queue)
|
||||
return web.json_response(current_queue, status=503)
|
||||
|
||||
@@ -136,6 +136,7 @@ class FetchQueue:
|
||||
with self.lock:
|
||||
if item in self.consumed:
|
||||
#TODO: Also update in queue
|
||||
#TODO: if complete check etag?
|
||||
self.consumed[item][1] = min(self.consumed[item][1], priority)
|
||||
return self.consumed[item][0]
|
||||
for i in range(len(self.queue)):
|
||||
@@ -209,6 +210,7 @@ async def prepare_file(url, path, priority):
|
||||
hashloc = await fetch_loop.enqueue(url, priority)
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
os.makedirs(os.path.split(path)[0], exist_ok=True)
|
||||
#TODO consider if symlinking would be better
|
||||
os.link(hashloc, path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user