Changes
2 changed files (+17/-4)
-
-
@@ -1199,7 +1199,7 @@break :req r; }; return self.internal.image_downloads.download(allocator, &req, self.internal.server) catch { return self.internal.image_downloads.download(self.internal.tsa.allocator(), &req, self.internal.server) catch { std.log.err("Out of memory during image download", .{}); return image.GetResult.makeRetainedError(.out_of_memory) catch null; };
-
-
-
@@ -495,6 +495,7 @@ const Job = struct {ready: std.Thread.ResetEvent = .{}, result: *GetResult = undefined, req_hash: u64, arc: Arc = .{}, }; const Cache = DoubleFifoCache(Image, opts.short_cache_size, opts.main_cache_size);
-
@@ -568,6 +569,12 @@{ var node = self.downloads_queue.first; while (node) |d| : (node = d.next) { d.data.arc.ref(); defer if (d.data.arc.unref()) { self.downloads_queue.remove(d); allocator.destroy(d); }; if (d.data.req_hash == req_hash) { d.data.ready.wait(); return d.data.result.retain();
-
@@ -575,14 +582,20 @@ }} } var node: std.DoublyLinkedList(Job).Node = .{ const node = try allocator.create(std.DoublyLinkedList(Job).Node); node.* = .{ .data = .{ .req_hash = req_hash, }, }; self.downloads_queue.prepend(&node); defer self.downloads_queue.remove(&node); node.data.arc.ref(); self.downloads_queue.prepend(node); defer if (node.data.arc.unref()) { self.downloads_queue.remove(node); allocator.destroy(node); }; const job_index: u5 = job_index: { self.mutex.lock();
-