Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(frontend): faster polling (#1535)
Liu Jiaf537fbf2483
diff --git a/frontend/src/components/DatabaseBackupPanel.vue b/frontend/src/components/DatabaseBackupPanel.vueindex fd08255556..307ca5e810 100644--- a/frontend/src/components/DatabaseBackupPanel.vue+++ b/frontend/src/components/DatabaseBackupPanel.vue@@ -159,7 +159,7 @@ import {NORMAL_POLL_INTERVAL,BackupPlanPolicyPayload,POLL_JITTER,- POST_CHANGE_POLL_INTERVAL,+ MINIMUM_POLL_INTERVAL,UNKNOWN_ID,} from "../types";import BackupTable from "../components/BackupTable.vue";@@ -332,7 +332,7 @@ export default defineComponent({databaseId: props.database.id,newBackup: newBackup,});- pollBackups(POST_CHANGE_POLL_INTERVAL);+ pollBackups(MINIMUM_POLL_INTERVAL);};// pollBackups invalidates the current timer and schedule a new timer in <<interval>> microsecondsdiff --git a/frontend/src/components/Issue/IssueDetailLayout.vue b/frontend/src/components/Issue/IssueDetailLayout.vueindex 8652087876..c80d3a33a5 100644--- a/frontend/src/components/Issue/IssueDetailLayout.vue+++ b/frontend/src/components/Issue/IssueDetailLayout.vue@@ -217,7 +217,6 @@ const runTaskChecks = (task: Task) => {taskId: task.id,}).then(() => {- // pollIssue(POST_CHANGE_POLL_INTERVAL);emit("status-changed", true);});};diff --git a/frontend/src/components/Issue/logic/extra.ts b/frontend/src/components/Issue/logic/extra.tsindex 70a35c3455..cc197aafb2 100644--- a/frontend/src/components/Issue/logic/extra.ts+++ b/frontend/src/components/Issue/logic/extra.ts@@ -163,14 +163,10 @@ export const useExtraIssueLogic = () => {status: newStatus,comment: comment,};- issueStore- .updateIssueStatus({- issueId: (issue.value as Issue).id,- issueStatusPatch,- })- .then(() => {- // pollIssue(POST_CHANGE_POLL_INTERVAL);- });+ issueStore.updateIssueStatus({+ issueId: (issue.value as Issue).id,+ issueStatusPatch,+ });};const changeStageAllTaskStatus = (diff --git a/frontend/src/plugins/issue/logic/poll/index.ts b/frontend/src/plugins/issue/logic/poll/index.tsindex b63e68df59..cab9b95a42 100644--- a/frontend/src/plugins/issue/logic/poll/index.ts+++ b/frontend/src/plugins/issue/logic/poll/index.ts@@ -6,7 +6,7 @@ import {IssueType,NORMAL_POLL_INTERVAL,POLL_JITTER,- POST_CHANGE_POLL_INTERVAL,+ MINIMUM_POLL_INTERVAL,} from "@/types";import { idFromSlug } from "@/utils";@@ -37,7 +37,7 @@ export const usePollIssue = (stopPolling();const int = Math.max(- 1000,+ MINIMUM_POLL_INTERVAL,Math.min(interval, NORMAL_POLL_INTERVAL) +(Math.random() * 2 - 1) * POLL_JITTER);@@ -62,7 +62,7 @@ export const usePollIssue = (Date.now() - (issue.value as Issue).updatedTs * 1000 < 5000;const { type } = issue.value;if (FASTER_TYPES.includes(type) && isNearNow) {- interval = POST_CHANGE_POLL_INTERVAL;+ interval = MINIMUM_POLL_INTERVAL;}pollIssue(interval);};diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.tsindex e370a0a96b..c2bac34f95 100644--- a/frontend/src/types/common.ts+++ b/frontend/src/types/common.ts@@ -41,13 +41,13 @@ export const ONBOARDING_ISSUE_ID = 101;// For text input, we do validation if there is no further keystroke after 1sexport const TEXT_VALIDATION_DELAY = 1000;-// Normally, we poll issue every 30s to fetch any update from the server side.-// If change occurs, then we will start the poll from 1s, 2s, 4s, 8s, 16s, 30s, 30s ... with jitter+// Normally, we poll issue every 10s to fetch any update from the server side.+// If change occurs, then we will start the poll from 0.2s, 0.4s, 0.8s, 1.6s, 3.2s, 5s, 10s, 10s ... with jitter// We do this because new update is more likely to happen after the initial change (e.g task gets new update after changing its status)-export const NORMAL_POLL_INTERVAL = 30000;-export const POST_CHANGE_POLL_INTERVAL = 1000;+export const NORMAL_POLL_INTERVAL = 10000;+export const MINIMUM_POLL_INTERVAL = 200;// Add jitter to avoid timer from different clients converging to the same polling frequency.-export const POLL_JITTER = 5000;+export const POLL_JITTER = 200;// It may take a while to perform instance related operations since we are// connecting the remote instance. And certain operations just take longer fordiff --git a/frontend/src/views/IssueDetail.vue b/frontend/src/views/IssueDetail.vueindex 646f71205f..6359c6dbae 100644--- a/frontend/src/views/IssueDetail.vue+++ b/frontend/src/views/IssueDetail.vue@@ -23,7 +23,7 @@ import { IssueDetailLayout } from "@/components/Issue";import {IssueType,NORMAL_POLL_INTERVAL,- POST_CHANGE_POLL_INTERVAL,+ MINIMUM_POLL_INTERVAL,Project,unknown,UNKNOWN_ID,@@ -73,7 +73,7 @@ watch(issueSlug, async () => {});const onStatusChanged = (eager: boolean) => {- pollIssue(eager ? POST_CHANGE_POLL_INTERVAL : NORMAL_POLL_INTERVAL);+ pollIssue(eager ? MINIMUM_POLL_INTERVAL : NORMAL_POLL_INTERVAL);};const findProject = async (): Promise<Project> => {