Skip to content

Commit ae7fd0c

Browse files
authored
refactor: Remove all code related to the old cache system (#25284)
* chore: Remove all code related to the old cache system * Removed some redundant tests, some type fixes * Further type fixes * More type fixes re. tests * Next iteration, couple of fixes remaining * Remove cache from CredentialActionsDropdown * Fix tests by mocking credential, instead of db queries * Remove Cache DI wiring from v2 * Make sure apiv2 build passes * Remove another cache cron * Remove old tokens for calendar-cache v1
1 parent d1184f6 commit ae7fd0c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+58
-2765
lines changed

PR_TODO.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

apps/api/v2/src/lib/modules/available-slots.module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { PrismaTeamRepository } from "@/lib/repositories/prisma-team.repository"
1010
import { PrismaUserRepository } from "@/lib/repositories/prisma-user.repository";
1111
import { AvailableSlotsService } from "@/lib/services/available-slots.service";
1212
import { BusyTimesService } from "@/lib/services/busy-times.service";
13-
import { CacheService } from "@/lib/services/cache.service";
1413
import { CheckBookingLimitsService } from "@/lib/services/check-booking-limits.service";
1514
import { FilterHostsService } from "@/lib/services/filter-hosts.service";
1615
import { NoSlotsNotificationService } from "@/lib/services/no-slots-notification.service";
@@ -35,7 +34,6 @@ import { Module } from "@nestjs/common";
3534
PrismaFeaturesRepository,
3635
PrismaMembershipRepository,
3736
CheckBookingLimitsService,
38-
CacheService,
3937
AvailableSlotsService,
4038
UserAvailabilityService,
4139
BusyTimesService,

apps/api/v2/src/lib/modules/regular-booking.module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { PrismaFeaturesRepository } from "@/lib/repositories/prisma-features.rep
44
import { PrismaHostRepository } from "@/lib/repositories/prisma-host.repository";
55
import { PrismaOOORepository } from "@/lib/repositories/prisma-ooo.repository";
66
import { PrismaUserRepository } from "@/lib/repositories/prisma-user.repository";
7-
import { CacheService } from "@/lib/services/cache.service";
87
import { CheckBookingAndDurationLimitsService } from "@/lib/services/check-booking-and-duration-limits.service";
98
import { CheckBookingLimitsService } from "@/lib/services/check-booking-limits.service";
109
import { HashedLinkService } from "@/lib/services/hashed-link.service";
@@ -22,7 +21,6 @@ import { Module } from "@nestjs/common";
2221
PrismaHostRepository,
2322
PrismaOOORepository,
2423
PrismaUserRepository,
25-
CacheService,
2624
CheckBookingAndDurationLimitsService,
2725
CheckBookingLimitsService,
2826
HashedLinkService,

apps/api/v2/src/lib/services/available-slots.service.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { PrismaSelectedSlotRepository } from "@/lib/repositories/prisma-selected
88
import { PrismaTeamRepository } from "@/lib/repositories/prisma-team.repository";
99
import { PrismaUserRepository } from "@/lib/repositories/prisma-user.repository";
1010
import { BusyTimesService } from "@/lib/services/busy-times.service";
11-
import { CacheService } from "@/lib/services/cache.service";
1211
import { CheckBookingLimitsService } from "@/lib/services/check-booking-limits.service";
1312
import { NoSlotsNotificationService } from "@/lib/services/no-slots-notification.service";
1413
import { QualifiedHostsService } from "@/lib/services/qualified-hosts.service";
@@ -34,7 +33,6 @@ export class AvailableSlotsService extends BaseAvailableSlotsService {
3433
featuresRepository: PrismaFeaturesRepository,
3534
qualifiedHostsService: QualifiedHostsService,
3635
checkBookingLimitsService: CheckBookingLimitsService,
37-
cacheService: CacheService,
3836
userAvailabilityService: UserAvailabilityService,
3937
busyTimesService: BusyTimesService,
4038
noSlotsNotificationService: NoSlotsNotificationService
@@ -50,7 +48,6 @@ export class AvailableSlotsService extends BaseAvailableSlotsService {
5048
userRepo: userRepository,
5149
redisClient: redisService,
5250
checkBookingLimitsService,
53-
cacheService,
5451
userAvailabilityService,
5552
busyTimesService,
5653
qualifiedHostsService,

apps/api/v2/src/lib/services/cache.service.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

apps/api/v2/src/lib/services/regular-booking.service.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { PrismaBookingRepository } from "@/lib/repositories/prisma-booking.repository";
22
import { PrismaUserRepository } from "@/lib/repositories/prisma-user.repository";
3-
import { CacheService } from "@/lib/services/cache.service";
43
import { CheckBookingAndDurationLimitsService } from "@/lib/services/check-booking-and-duration-limits.service";
54
import { HashedLinkService } from "@/lib/services/hashed-link.service";
65
import { LuckyUserService } from "@/lib/services/lucky-user.service";
@@ -13,7 +12,6 @@ import type { PrismaClient } from "@calcom/prisma";
1312
@Injectable()
1413
export class RegularBookingService extends BaseRegularBookingService {
1514
constructor(
16-
cacheService: CacheService,
1715
checkBookingAndDurationLimitsService: CheckBookingAndDurationLimitsService,
1816
prismaWriteService: PrismaWriteService,
1917
bookingRepository: PrismaBookingRepository,
@@ -22,7 +20,6 @@ export class RegularBookingService extends BaseRegularBookingService {
2220
userRepository: PrismaUserRepository
2321
) {
2422
super({
25-
cacheService,
2623
checkBookingAndDurationLimitsService,
2724
prismaClient: prismaWriteService.prisma as unknown as PrismaClient,
2825
bookingRepository,

apps/web/app/api/availability/calendar/route.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { NextResponse } from "next/server";
55
import { z } from "zod";
66

77
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
8-
import { CalendarCache } from "@calcom/features/calendar-cache/calendar-cache";
98
import {
109
getCalendarCredentials,
1110
getConnectedCalendars,
@@ -92,15 +91,9 @@ async function deleteHandler(req: NextRequest) {
9291
const user = await authMiddleware();
9392
const searchParams = Object.fromEntries(req.nextUrl.searchParams.entries());
9493

95-
const { integration, externalId, credentialId, eventTypeId } =
94+
const { integration, externalId, eventTypeId } =
9695
selectedCalendarSelectSchema.parse(searchParams);
9796

98-
const calendarCacheRepository = await CalendarCache.initFromCredentialId(credentialId);
99-
await calendarCacheRepository.unwatchCalendar({
100-
calendarId: externalId,
101-
eventTypeIds: [eventTypeId ?? null],
102-
});
103-
10497
await SelectedCalendarRepository.delete({
10598
where: {
10699
userId: user.id,

apps/web/app/api/cron/calendar-cache-cleanup/route.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

apps/web/cron-tester.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ try {
2424
async function () {
2525
await Promise.allSettled([
2626
fetchCron("/cron/calendar-subscriptions"),
27-
// fetchCron("/calendar-cache/cron"),
2827
// fetchCron("/cron/calVideoNoShowWebhookTriggers"),
2928
fetchCron("/tasks/cron"),
3029
]);

apps/web/pages/api/calendar-cache/cron.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)