Skip to content

Commit

Permalink
Fix perftester when starting on empty board
Browse files Browse the repository at this point in the history
  • Loading branch information
raimohanska committed Jan 30, 2024
1 parent ae2729d commit e8202de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion perf-tester/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ function createTester(nickname: string, boardId: string) {
connections: [],
})
}
if (Math.random() < editsPerInterval) {
if (Math.random() < editsPerInterval && notes.length > 0) {
const target = _.sample(notes)!
if (!target) {
throw Error("Target item not found")
}
const updated = { ...target, text: "EDIT " + counter, color: _.sample(NOTE_COLORS)?.color! }
connection.send({
ackId: "perf",
Expand Down

0 comments on commit e8202de

Please sign in to comment.