* Delete the partial message file for a workspace.
(workspaceId: string)
| 1205 | * Delete the partial message file for a workspace. |
| 1206 | */ |
| 1207 | async deletePartial(workspaceId: string): Promise<Result<void>> { |
| 1208 | return this.fileLocks.withLock(workspaceId, async () => { |
| 1209 | try { |
| 1210 | const partialPath = this.getPartialPath(workspaceId); |
| 1211 | await fs.unlink(partialPath); |
| 1212 | return Ok(undefined); |
| 1213 | } catch (error) { |
| 1214 | if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") { |
| 1215 | return Ok(undefined); |
| 1216 | } |
| 1217 | const errorMessage = getErrorMessage(error); |
| 1218 | return Err(`Failed to delete partial: ${errorMessage}`); |
| 1219 | } |
| 1220 | }); |
| 1221 | } |
| 1222 | |
| 1223 | /** |
| 1224 | * Delete the partial message file only when it still belongs to the expected message. |
no test coverage detected