Browse Source

optimize index cache

Signed-off-by: ryjiang <jiangruiyi@gmail.com>
ryjiang 1 year ago
parent
commit
720c3bc132
1 changed files with 3 additions and 2 deletions
  1. 3 2
      server/src/schema/schema.service.ts

+ 3 - 2
server/src/schema/schema.service.ts

@@ -47,8 +47,9 @@ export class SchemaService {
       // If the index is finished building and there is at least one index description,
       // cache the index description for future use
       if (
-        res.index_descriptions?.length > 0 &&
-        res.index_descriptions.every(i => i.state === 'Finished')
+        (res.index_descriptions?.length > 0 &&
+          res.index_descriptions.every(i => i.state === 'Finished')) ||
+        res.index_descriptions.length === 0
       ) {
         indexCache.set(key, res);
       } else {