Skip to content

Commit 84afd40

Browse files
committed
🐛 Fix: limit how many dates are generated
this dramatically sped up tests, because the rrule.all() was generating 400k+ dates
1 parent 4cdb3f5 commit 84afd40

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/backend/src/event/services/recur/providers/compass/compass.recur.provider.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe("Compass Recurring Event Provider", () => {
7878
expect(instances[0]?.recurrence?.rule).toBeUndefined();
7979
expect(instances[1]?.startDate).toBe("2024-04-03T10:00:00.000Z");
8080
expect(instances[1]?.recurrence?.rule).toBeUndefined();
81-
}, 6000);
81+
});
8282
});
8383
describe("CREATE: instances", () => {
8484
it("should insert multiple event instances", async () => {

packages/backend/src/event/services/recur/util/recur.util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const generateRecurringInstances = (
7676

7777
// Create the RRule with the base event's start date
7878
const dtstart = baseStart.format("YYYYMMDDTHHmmss");
79-
const fullRuleString = `DTSTART=${dtstart}Z\n${ruleString}`;
79+
const fullRuleString = `DTSTART=${dtstart}Z\n${ruleString};COUNT=${maxInstances}`;
8080
const rule = RRule.fromString(fullRuleString);
8181

8282
// Get all dates from the rule

0 commit comments

Comments
 (0)