@cornerstonejs/core 1.44.2 → 1.44.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "1.44.2",
3
+ "version": "1.44.3",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/types/index.d.ts",
@@ -47,5 +47,5 @@
47
47
  "type": "individual",
48
48
  "url": "https://ohif.org/donate"
49
49
  },
50
- "gitHead": "61b88d31b0043ad6cad97a0de209e7663db11172"
50
+ "gitHead": "2d4cc217d2f58d5089945e6f5f651cbeda3dd85f"
51
51
  }
@@ -230,6 +230,7 @@ class RequestPoolManager {
230
230
 
231
231
  private sendRequests(type) {
232
232
  const requestsToSend = this.maxNumRequests[type] - this.numRequests[type];
233
+ let syncImageCount = 0;
233
234
 
234
235
  for (let i = 0; i < requestsToSend; i++) {
235
236
  const requestDetails = this.getNextRequest(type);
@@ -239,12 +240,28 @@ class RequestPoolManager {
239
240
  this.numRequests[type]++;
240
241
  this.awake = true;
241
242
 
242
- requestDetails.requestFn()?.finally(() => {
243
+ let requestResult;
244
+ try {
245
+ requestResult = requestDetails.requestFn();
246
+ } catch (e) {
247
+ // This is the only warning one will get, so need a warn message
248
+ console.warn('sendRequest failed', e);
249
+ }
250
+ if (requestResult?.finally) {
251
+ requestResult.finally(() => {
252
+ this.numRequests[type]--;
253
+ this.startAgain();
254
+ });
255
+ } else {
256
+ // Handle non-async request functions too - typically just short circuit ones
243
257
  this.numRequests[type]--;
244
- this.startAgain();
245
- });
258
+ syncImageCount++;
259
+ }
246
260
  }
247
261
  }
262
+ if (syncImageCount) {
263
+ this.startAgain();
264
+ }
248
265
 
249
266
  return true;
250
267
  }