* Drop queued run metadata for a workspace. * * When metadataId is provided, clear only that request's entry. * This prevents one request's cleanup path from deleting metadata queued by * overlapping requests in the same workspace.
(workspaceId: string, metadataId?: string)
| 144 | * overlapping requests in the same workspace. |
| 145 | */ |
| 146 | clearPendingRunMetadata(workspaceId: string, metadataId?: string): void { |
| 147 | assert( |
| 148 | workspaceId.trim().length > 0, |
| 149 | "DevToolsService.clearPendingRunMetadata requires a workspaceId" |
| 150 | ); |
| 151 | |
| 152 | const byWorkspace = this.pendingRunMetadata.get(workspaceId); |
| 153 | if (!byWorkspace) { |
| 154 | return; |
| 155 | } |
| 156 | |
| 157 | if (metadataId == null) { |
| 158 | this.pendingRunMetadata.delete(workspaceId); |
| 159 | return; |
| 160 | } |
| 161 | |
| 162 | assert( |
| 163 | metadataId.trim().length > 0, |
| 164 | "DevToolsService.clearPendingRunMetadata requires a non-empty metadataId" |
| 165 | ); |
| 166 | |
| 167 | byWorkspace.delete(metadataId); |
| 168 | if (byWorkspace.size === 0) { |
| 169 | this.pendingRunMetadata.delete(workspaceId); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | async createRun(workspaceId: string, run: DevToolsRun, metadataId?: string): Promise<void> { |
| 174 | if (!this.enabled) { |
no test coverage detected