浏览代码

add more interval to avoid sending too many requests to milvus (#146)

ryjiang 2 年之前
父节点
当前提交
866593e4f3
共有 3 个文件被更改,包括 17 次插入15 次删除
  1. 13 11
      client/src/pages/schema/Create.tsx
  2. 1 1
      client/src/pages/schema/IndexTypeElement.tsx
  3. 3 3
      server/src/crons/crons.service.ts

+ 13 - 11
client/src/pages/schema/Create.tsx

@@ -312,18 +312,20 @@ const CreateIndex = (props: {
       showCode={showCode}
       codeBlocksData={codeBlockData}
     >
-      <CreateForm
-        updateForm={updateStepTwoForm}
-        metricOptions={metricOptions}
-        indexOptions={indexOptions}
-        formValue={indexSetting}
-        checkIsValid={checkIsValid}
-        validation={validation}
-        indexParams={indexCreateParams}
-        indexTypeChange={onIndexTypeChange}
-      />
+      <>
+        <CreateForm
+          updateForm={updateStepTwoForm}
+          metricOptions={metricOptions}
+          indexOptions={indexOptions}
+          formValue={indexSetting}
+          checkIsValid={checkIsValid}
+          validation={validation}
+          indexParams={indexCreateParams}
+          indexTypeChange={onIndexTypeChange}
+        />
 
-      <SizingInfo info={sizingInfo} />
+        <SizingInfo info={sizingInfo} />
+      </>
     </DialogTemplate>
   );
 };

+ 1 - 1
client/src/pages/schema/IndexTypeElement.tsx

@@ -116,7 +116,7 @@ const IndexTypeElement: FC<{
           ? fetchStatus()
           : timer && clearTimeout(timer);
         setStatus(status);
-      }, 500);
+      }, 3000);
     }
   }, [collectionName, data, status]);
 

+ 3 - 3
server/src/crons/crons.service.ts

@@ -54,7 +54,7 @@ export class CronsService {
         throw new Error(error);
       }
     };
-    this.schedulerRegistry.setCronJobEverySecond(name, task, address);
+    this.schedulerRegistry.setCronJobEveryFiveSecond(name, task, address);
   }
 }
 
@@ -68,9 +68,9 @@ export class SchedulerRegistry {
     return target?.entity;
   }
 
-  setCronJobEverySecond(name: string, func: () => {}, address: string) {
+  setCronJobEveryFiveSecond(name: string, func: () => {}, address: string) {
     // The cron job will run every second
-    this.setCronJob(name, '* * * * * *', func, address);
+    this.setCronJob(name, '*/5 * * * * *', func, address);
   }
 
   // ┌────────────── second (optional)