diff --git a/src/core/CoreNode.ts b/src/core/CoreNode.ts index 331bc219..22ad2e66 100644 --- a/src/core/CoreNode.ts +++ b/src/core/CoreNode.ts @@ -918,10 +918,16 @@ export class CoreNode extends EventEmitter { this.notifyParentRTTOfUpdate(); } - this.emit('failed', { - type: 'texture', - error, - } satisfies NodeTextureFailedPayload); + // only emit failed outward if we've exhausted all retry attempts + if ( + this.texture !== null && + this.texture.retryCount > this.texture.maxRetryCount + ) { + this.emit('failed', { + type: 'texture', + error, + } satisfies NodeTextureFailedPayload); + } }; private onTextureFreed: TextureFreedEventHandler = () => { diff --git a/src/core/textures/SubTexture.ts b/src/core/textures/SubTexture.ts index 5b3e329b..a2cdb5f4 100644 --- a/src/core/textures/SubTexture.ts +++ b/src/core/textures/SubTexture.ts @@ -137,6 +137,8 @@ export class SubTexture extends Texture { }; private onParentTxFailed: TextureFailedEventHandler = (target, error) => { + //decrement with 1 because in the failed state it will do +1 again. + this.retryCount = this.parentTexture.retryCount - 1; this.forwardParentTxState('failed', error); };