Skip to content

Commit

Permalink
BC-6854 - basic load tests (#3319)
Browse files Browse the repository at this point in the history
improvements need to for very big boards with many cards

* increase minimum wait time for fetchCards to 30ms => better chance to request multiple cards with one request
* split fetchCard requests into batches => better chance to get some of the answers earlier
  • Loading branch information
hoeppner-dataport authored Jul 15, 2024
1 parent 4ffa434 commit d919763
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit d919763

Please sign in to comment.