@byted-apaas/server-sdk-node 1.1.26 → 1.1.27-beta.0
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/kunlun/operator/impl/logic.js +15 -15
- package/package.json +1 -1
|
@@ -424,24 +424,24 @@ async function handleLookupCondition(conditions) {
|
|
|
424
424
|
let lookupMap = new Map(), dateSet = new Set();
|
|
425
425
|
let firstObjApiName = conditions[0].left.settings.fieldPath[0].objectApiName;
|
|
426
426
|
let fields = [];
|
|
427
|
+
// 未命中缓存的字段
|
|
428
|
+
let missFields = [...queryMap.keys()];
|
|
427
429
|
const needReadCache = server_common_node_1.utils.getLaneID() !== ''; // 仅打包发布 2.0 支持走 cache
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (cacheResult !== null && cacheResult.missFields.length === 0) {
|
|
434
|
-
fields = cacheResult.successFields;
|
|
435
|
-
}
|
|
436
|
-
// 未命中缓存 / 不读缓存
|
|
437
|
-
if ((cacheResult !== null && cacheResult.missFields.length === 1) || (!needReadCache && queryMap.size === 1)) {
|
|
438
|
-
if (cacheResult !== null && cacheResult.missFields.length === 1) {
|
|
439
|
-
fieldName = cacheResult.missFields[0];
|
|
430
|
+
if (needReadCache) {
|
|
431
|
+
const cacheResult = getLookupObjectAPINamesFromCache(firstObjApiName, queryMap);
|
|
432
|
+
if (cacheResult) {
|
|
433
|
+
fields = cacheResult.successFields;
|
|
434
|
+
missFields = cacheResult.missFields;
|
|
440
435
|
}
|
|
441
|
-
fields.push(await Request.GetInstance().getField(firstObjApiName, fieldName));
|
|
442
436
|
}
|
|
443
|
-
|
|
444
|
-
|
|
437
|
+
// 获取未命中缓存的字段,通过 API 获取
|
|
438
|
+
if (missFields.length === 1) { // 单个获取
|
|
439
|
+
fields.push(await Request.GetInstance().getField(firstObjApiName, missFields[0]));
|
|
440
|
+
}
|
|
441
|
+
else if (missFields.length > 1) { // 批量获取
|
|
442
|
+
const allFields = await Request.GetInstance().getFields(firstObjApiName);
|
|
443
|
+
const fetchSet = new Set(missFields);
|
|
444
|
+
fields.push(...allFields.filter((f) => fetchSet.has(f.api_name)));
|
|
445
445
|
}
|
|
446
446
|
for (const field of fields) {
|
|
447
447
|
parseFieldInfo(field, lookupMap, dateSet);
|