Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mahendraHegde committed Jan 23, 2025
1 parent aa998d7 commit af4919d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app/emails/email.worker.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import type { EmailPayloadType } from "./types";
import { SMTP_FROM } from "../utils/env";
import { ShelfError } from "../utils/error";

// every node will execute 5 jobs(teamSize) every 3 minutes(newJobCheckIntervalSeconds),
// increase teamSize if you need better concurrency
// but keep email provider rate limiting and a potential n/w throughput load on postgress in mind
// teamSize of 20-25 is a good limit if we need to scale email throughput in the future
export const registerEmailWorkers = async () => {
await scheduler.work<EmailPayloadType>(
QueueNames.emailQueue,
{ newJobCheckIntervalSeconds: 60 * 3, teamSize: 2 },
{ newJobCheckIntervalSeconds: 60 * 3, teamSize: 5 },
async (job) => {
await triggerEmail(job.data);
}
Expand Down
1 change: 0 additions & 1 deletion app/modules/booking/email-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { BookingForEmail } from "~/emails/types";
import { getDateTimeFormatFromHints } from "~/utils/client-hints";
import { getTimeRemainingMessage } from "~/utils/date-fns";
import { SERVER_URL } from "~/utils/env";
import { ShelfError } from "~/utils/error";
import type { ClientHint } from "./types";

/**
Expand Down
1 change: 0 additions & 1 deletion app/modules/booking/service.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,6 @@ export async function bulkDeleteBookings({
}),
}));

// Send emails with rate limiting
return emailConfigs.map(sendEmail);
} catch (cause) {
const message =
Expand Down

0 comments on commit af4919d

Please sign in to comment.