reduce campaigns and ses webhook concurrency
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
import { validateDomainFromEmail } from "~/server/service/domain-service";
|
||||
import {
|
||||
getDocumentUploadUrl,
|
||||
isStorageConfigured
|
||||
isStorageConfigured,
|
||||
} from "~/server/service/storage-service";
|
||||
|
||||
const statuses = Object.values(CampaignStatus) as [CampaignStatus];
|
||||
@@ -63,8 +63,18 @@ export const campaignRouter = createTRPCRouter({
|
||||
skip: offset,
|
||||
take: limit,
|
||||
});
|
||||
let time = performance.now();
|
||||
|
||||
campaignsP.then((campaigns) => {
|
||||
console.log(
|
||||
`Time taken to get campaigns: ${performance.now() - time} milliseconds`
|
||||
);
|
||||
});
|
||||
|
||||
const [campaigns, count] = await Promise.all([campaignsP, countP]);
|
||||
console.log(
|
||||
`Time taken to get campaigns and count: ${performance.now() - time} milliseconds`
|
||||
);
|
||||
|
||||
return { campaigns, totalPage: Math.ceil(count / limit) };
|
||||
}),
|
||||
|
@@ -379,7 +379,7 @@ export async function updateCampaignAnalytics(
|
||||
});
|
||||
}
|
||||
|
||||
const CAMPAIGN_EMAIL_CONCURRENCY = 200;
|
||||
const CAMPAIGN_EMAIL_CONCURRENCY = 50;
|
||||
|
||||
class CampaignEmailService {
|
||||
private static campaignQueue = new Queue(CAMPAIGN_MAIL_PROCESSING_QUEUE, {
|
||||
|
@@ -290,7 +290,7 @@ export class SesHookParser {
|
||||
},
|
||||
{
|
||||
connection: getRedis(),
|
||||
concurrency: 200,
|
||||
concurrency: 50,
|
||||
}
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user