Removed logs
This commit is contained in:
parent
98e9d18663
commit
cda50bd096
@ -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();
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user