Removed logs

This commit is contained in:
Vins 2023-09-25 14:06:49 +02:00
parent 98e9d18663
commit cda50bd096
3 changed files with 1 additions and 6 deletions

View File

@ -13,7 +13,6 @@ import CronService from "@Services/common/CronService/CronService";
Container.get(CronService).archiveFiles();
await Container.get(CronService).updateUsers();
if(variables.ENV !== "dev"){
console.log("STG Good");
Container.get(CronService).sendMails();
Container.get(CronService).sendRecapMails();
}

View File

@ -10,7 +10,7 @@ export default class CronService {
constructor(private mailchimpService: MailchimpService, private filesService: FilesService, private idNotService: IdNotService) {}
public async sendMails() {
const cronJob = new CronJob("*/15 * * * * *", async () => { // Every 15 minutes
const cronJob = new CronJob("*/15 * * * * *", async () => { // Every 15 seconds
try {
await this.mailchimpService.sendEmails();
} catch (e) {

View File

@ -52,9 +52,7 @@ export default class MailchimpService extends BaseService {
* @throws {Error} If email cannot be sent
*/
public async sendEmails() {
console.log("sendEmails");
const emailsToSend = await this.get({ where: { sentAt: null } });
console.log(emailsToSend);
const currentDate = new Date();
let nextTrySendDate = null;
@ -74,14 +72,12 @@ export default class MailchimpService extends BaseService {
//If the next try send date is passed, we send the email
if (currentDate >= nextTrySendDate) {
console.log("if currentDate > nextTrySendDate");
try {
await this.sendEmail(email);
email.sentAt = currentDate;
} catch (error) {
email.lastTrySendDate = currentDate;
email.nbTrySend = email.nbTrySend! + 1;
console.log(error);
}
await this.update(email.uid, email);
}