MCPcopy
hub / github.com/coder/mux / deletePartial

Method deletePartial

src/node/services/historyService.ts:1207–1221  ·  view source on GitHub ↗

* Delete the partial message file for a workspace.

(workspaceId: string)

Source from the content-addressed store, hash-verified

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.

Calls 5

getPartialPathMethod · 0.95
OkFunction · 0.90
getErrorMessageFunction · 0.90
ErrFunction · 0.90
withLockMethod · 0.80

Tested by

no test coverage detected