From e5d4a3f456ed44c784c2206011a942a297578ec3 Mon Sep 17 00:00:00 2001 From: Il Harper Date: Sat, 5 Oct 2024 15:31:02 +0800 Subject: [PATCH] fix(api): fix groupNotify --- .../engine-chronocat-api/src/services/groupNotify.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/engine-chronocat-api/src/services/groupNotify.ts b/packages/engine-chronocat-api/src/services/groupNotify.ts index 7dab293..0a7c025 100644 --- a/packages/engine-chronocat-api/src/services/groupNotify.ts +++ b/packages/engine-chronocat-api/src/services/groupNotify.ts @@ -1,4 +1,4 @@ -import { debounce } from 'lodash-es' +import { throttle } from 'lodash-es' import { getSingleScreenNotifies } from '../definitions/groupService' const refreshIntl2 = async () => { @@ -14,8 +14,13 @@ const refreshIntl2 = async () => { }) } -const refreshIntl1 = debounce(refreshIntl2, 2000, { - maxWait: 2000, +// const refreshIntl1 = debounce(refreshIntl2, 2000, { +// maxWait: 2000, +// }) + +const refreshIntl1 = throttle(refreshIntl2, 4000, { + leading: true, + trailing: false, }) const refresh = () => setTimeout(refreshIntl1, 2000)