dserve icon indicating copy to clipboard operation
dserve copied to clipboard

Reset shared image cache on docker pull failure

Open aduth opened this issue 9 months ago • 0 comments

Fixes the issue identified at https://github.com/Automattic/wp-calypso/pull/103848#discussion_r2124587176

The pullImage function uses internal state to ensure that multiple concurrent pulls are only executed a single time.

After a pull succeeds or fails via some docker pull progress result, the state value is released so that future pulls can try again (source). However, if the docker pull fails before it gets to progress updates (e.g. "Not found"), the state value is never released, and subsequent pull attempts will always fail, even if the image would eventually become available, such as the situation described in https://github.com/Automattic/wp-calypso/pull/103848#discussion_r2124587176.

The changes here ensure that the state value is consistently released after the pull finishes, successfully or otherwise.

Testing Instructions:

Verify test coverage fails when changes to src/api.ts are reset:

git checkout master -- src/api.ts
yarn test test/api.test.ts

aduth avatar Jun 03 '25 19:06 aduth