Last active
June 12, 2023 23:57
-
-
Save sminnee/f9c70b8a12e2bc4759d3acfffcfaeebb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/client/src/services/files.ts b/client/src/services/files.ts | |
index 416a1710b..00dc54f84 100644 | |
--- a/client/src/services/files.ts | |
+++ b/client/src/services/files.ts | |
@@ -2,7 +2,7 @@ import { callAPI } from "services/util"; | |
import { getAPIAuthentication } from "services/auth"; | |
import PQueue from "p-queue"; | |
-const uploadQueue = new PQueue({ concurrency: 4 }); | |
+export const uploadQueue = new PQueue({ concurrency: 4 }); | |
/** | |
* Uploads a file to a temporary location, returning a referernce code, with a maximum concurrency and a queue | |
diff --git a/client/src/services/work-orders/sections/index.ts b/client/src/services/work-orders/sections/index.ts | |
index 045af92b9..699c7cbd2 100644 | |
--- a/client/src/services/work-orders/sections/index.ts | |
+++ b/client/src/services/work-orders/sections/index.ts | |
@@ -13,11 +13,11 @@ import { | |
} from "entities/work-order/sections"; | |
import { WorkOrderDescriptor } from "entities/work-order"; | |
import { readInspectionSectionItem, readPhotoInspectionAnswer, writePhotoInspectionAnswer } from "./inspections"; | |
-import { flatten } from "lodash"; | |
+import { flatten, update } from "lodash"; | |
import { addPrefix } from "util/array"; | |
import PQueue from "p-queue"; | |
-const updateQueue = new PQueue({ concurrency: 4 }); | |
+export const updateQueue = new PQueue({ concurrency: 4 }); | |
export function readInspectionSection(data: any): InspectionSection { | |
const type: InspectionSectionType = data.type; | |
diff --git a/client/src/state/entities/window-api.ts b/client/src/state/entities/window-api.ts | |
index 4155e5867..37fc04129 100644 | |
--- a/client/src/state/entities/window-api.ts | |
+++ b/client/src/state/entities/window-api.ts | |
@@ -10,6 +10,8 @@ import { waitFor } from "util/promises"; | |
import { DateTime } from "util/time"; | |
import { EntityDef } from "./builder"; | |
import { ENTITIES, EntityTypeName } from "./registry"; | |
+import { updateQueue } from "services/work-orders/sections"; | |
+import { uploadQueue } from "services/files"; | |
function createEntityApi(store: any, dispatch: any) { | |
return { | |
@@ -108,7 +110,7 @@ function createEntityApi(store: any, dispatch: any) { | |
}, | |
// Return the number of pending API calls | |
- numPendingAPICalls: () => defaultAPIHandler.numPending, | |
+ numPendingAPICalls: () => defaultAPIHandler.numPending + updateQueue.size + uploadQueue.size, | |
}; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment