( options: BeginResumableUploadOptions, key: string, )
| 154 | } |
| 155 | |
| 156 | function createResumableUploadEntry( |
| 157 | options: BeginResumableUploadOptions, |
| 158 | key: string, |
| 159 | ): ResumableUploadEntry { |
| 160 | const id = crypto.randomUUID(); |
| 161 | const tempDir = createArtifactTempDir('upload'); |
| 162 | const entry: ResumableUploadEntry = { |
| 163 | id, |
| 164 | key, |
| 165 | tempDir, |
| 166 | payloadPath: path.join(tempDir, 'payload'), |
| 167 | fileName: sanitizeArtifactFilename(options.fileName), |
| 168 | sizeBytes: options.sizeBytes, |
| 169 | sha256: options.sha256.toLowerCase(), |
| 170 | artifactType: options.artifactType, |
| 171 | platform: options.platform, |
| 172 | tenantId: options.tenantId, |
| 173 | timer: setTimeout(() => cleanupResumableUpload(id), RESUMABLE_UPLOAD_CLEANUP_TIMEOUT_MS), |
| 174 | }; |
| 175 | entry.timer.unref(); |
| 176 | RESUMABLE_UPLOADS_BY_ID.set(id, entry); |
| 177 | RESUMABLE_UPLOADS_BY_KEY.set(key, id); |
| 178 | return entry; |
| 179 | } |
| 180 | |
| 181 | function refreshResumableUploadTimer(entry: ResumableUploadEntry): void { |
| 182 | clearTimeout(entry.timer); |
no test coverage detected
searching dependent graphs…