| ... | @@ -139,7 +139,11 @@ pub const CacheHash = struct { | ... | @@ -139,7 +139,11 @@ pub const CacheHash = struct { |
| 139 | const manifest_file_path = try fmt.allocPrint(self.alloc, "{}.txt", .{self.b64_digest}); | 139 | const manifest_file_path = try fmt.allocPrint(self.alloc, "{}.txt", .{self.b64_digest}); |
| 140 | defer self.alloc.free(manifest_file_path); | 140 | defer self.alloc.free(manifest_file_path); |
| 141 | | 141 | |
| 142 | self.manifest_file = try self.manifest_dir.createFile(manifest_file_path, .{ .read = true, .truncate = false }); | 142 | self.manifest_file = try self.manifest_dir.createFile(manifest_file_path, .{ |
| | 143 | .read = true, |
| | 144 | .truncate = false, |
| | 145 | .lock = .Exclusive, |
| | 146 | }); |
| 143 | } | 147 | } |
| 144 | | 148 | |
| 145 | // TODO: Figure out a good max value? | 149 | // TODO: Figure out a good max value? |
| ... | @@ -213,7 +217,7 @@ pub const CacheHash = struct { | ... | @@ -213,7 +217,7 @@ pub const CacheHash = struct { |
| 213 | | 217 | |
| 214 | if (any_file_changed) { | 218 | if (any_file_changed) { |
| 215 | // cache miss | 219 | // cache miss |
| 216 | // keep the manifest file open (TODO: with rw lock) | 220 | // keep the manifest file open |
| 217 | // reset the hash | 221 | // reset the hash |
| 218 | self.blake3 = Blake3.init(); | 222 | self.blake3 = Blake3.init(); |
| 219 | self.blake3.update(&bin_digest); | 223 | self.blake3.update(&bin_digest); |