[MWPW-192702] Fixing issues observed from evaluating the errors in analytics dashboard. #740
Conversation
| ); | ||
| } else { | ||
| await this.uploadImgToUnity(href, id, file, file.type, signal); | ||
| await this.scanImgForSafety(this.assetId, signal); |
There was a problem hiding this comment.
The recursive call inside setTimeout inside scanImgForSafety is not awaited and its return value is discarded. This means Upload server error|UnityWidget is never logged for any HTTP-level failure from scanImgForSafety — and separately, the entire upload flow incorrectly reports success (Upload Completed|UnityWidget) even when the safety scan is failing in a detached infinite retry loop in the background.
| const chunkInfo = { chunkIndex: i, chunkNumber }; | ||
| failedChunks.add(chunkInfo); | ||
| if (onChunkError) onChunkError(chunkInfo, err); | ||
| if (err.name !== 'AbortError') { |
There was a problem hiding this comment.
A dedicated chunkAbortController is created per upload session. Its signal is merged with the user-cancel signal via AbortSignal.any and passed to all chunks. When any chunk reaches final failure, chunkAbortController.abort() is called before throwing — immediately cancelling all sibling in-flight HTTP requests. AbortErrors in createChunkUploadTasks are excluded from failedChunks so only genuine failures are counted.
| const timeout = setTimeout(() => controller.abort(), timeoutMs); | ||
| const passedSignal = options.signal || controller.signal; | ||
| const mergedOptions = { ...options, signal: passedSignal }; | ||
| const mergedSignal = options.signal |
There was a problem hiding this comment.
Used options.signal || controller.signal — only one signal was ever active. If an external signal was provided, the 60s timeout controller was completely ignored, making timeouts silently broken.
FIx: AbortSignal.any([controller.signal, options.signal]) — both fire correctly. The abort-source check (if (options.signal?.aborted) throw e) re-throws external aborts as AbortError instead of incorrectly converting them to TimeoutError. This means sibling chunk cancellations now correctly propagate as AbortError and are handled silently.
| const onSuccessWithAttempt = onSuccess ? (response) => onSuccess(response, attempt) : null; | ||
| const onErrorWithAttempt = onError ? (error) => onError(error, attempt) : null; | ||
| let response = await this.fetchFromService(url, options, onSuccessWithAttempt, onErrorWithAttempt); | ||
| if (!response) { |
There was a problem hiding this comment.
With this if fetchFromService returns undefined, the loop delays and retries (or breaks on the final attempt) instead of crashing.
|
verified some flows as per given notes. screen shots are updated in story. will do through testing in stage from user prospective to make sure rest of positive flows are fine @arugupta1992 @sanjayms01 |
Issue Fix Descriptions : Explained in the comments
Testing Notes: Refer to wiki
Resolves: MWPW-192702
Test URLs:
Before: https://main--cc--adobecom.aem.page/products/firefly/features/remove-object-from-photo?unitylibs=stage
After: https://main--cc--adobecom.aem.page/products/firefly/features/remove-object-from-photo?unitylibs=analyticsIssues