Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-6854 - basic load tests #3319

Merged
merged 5 commits into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { chunk } from "lodash";
import * as CardActions from "./cardActions";
import { useSocketConnection } from "@data-board";
import { useCardStore } from "../Card.store";
Expand All @@ -20,7 +21,7 @@ import { useBoardAriaNotification } from "../ariaNotification/ariaLiveNotificati
export const useCardSocketApi = () => {
const cardStore = useCardStore();

const WAIT_AFTER_LAST_CALL_IN_MS = 5;
const WAIT_AFTER_LAST_CALL_IN_MS = 30;
const MAX_WAIT_BEFORE_FIRST_CALL_IN_MS = 200;
let cardIdsToFetch: string[] = [];

Expand Down Expand Up @@ -92,7 +93,10 @@ export const useCardSocketApi = () => {

const _debouncedFetchCardEmit = useDebounceFn(
() => {
emitOnSocket("fetch-card-request", { cardIds: cardIdsToFetch });
const batches = chunk(cardIdsToFetch, 50);
batches.forEach((cardIds) =>
emitOnSocket("fetch-card-request", { cardIds })
);
cardIdsToFetch = [];
},
WAIT_AFTER_LAST_CALL_IN_MS,
Expand Down
Loading