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();
|
Container.get(CronService).archiveFiles();
|
||||||
await Container.get(CronService).updateUsers();
|
await Container.get(CronService).updateUsers();
|
||||||
if(variables.ENV !== "dev"){
|
if(variables.ENV !== "dev"){
|
||||||
console.log("STG Good");
|
|
||||||
Container.get(CronService).sendMails();
|
Container.get(CronService).sendMails();
|
||||||
Container.get(CronService).sendRecapMails();
|
Container.get(CronService).sendRecapMails();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ export default class CronService {
|
|||||||
constructor(private mailchimpService: MailchimpService, private filesService: FilesService, private idNotService: IdNotService) {}
|
constructor(private mailchimpService: MailchimpService, private filesService: FilesService, private idNotService: IdNotService) {}
|
||||||
|
|
||||||
public async sendMails() {
|
public async sendMails() {
|
||||||
const cronJob = new CronJob("*/15 * * * * *", async () => { // Every 15 minutes
|
const cronJob = new CronJob("*/15 * * * * *", async () => { // Every 15 seconds
|
||||||
try {
|
try {
|
||||||
await this.mailchimpService.sendEmails();
|
await this.mailchimpService.sendEmails();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -52,9 +52,7 @@ export default class MailchimpService extends BaseService {
|
|||||||
* @throws {Error} If email cannot be sent
|
* @throws {Error} If email cannot be sent
|
||||||
*/
|
*/
|
||||||
public async sendEmails() {
|
public async sendEmails() {
|
||||||
console.log("sendEmails");
|
|
||||||
const emailsToSend = await this.get({ where: { sentAt: null } });
|
const emailsToSend = await this.get({ where: { sentAt: null } });
|
||||||
console.log(emailsToSend);
|
|
||||||
const currentDate = new Date();
|
const currentDate = new Date();
|
||||||
let nextTrySendDate = null;
|
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 the next try send date is passed, we send the email
|
||||||
if (currentDate >= nextTrySendDate) {
|
if (currentDate >= nextTrySendDate) {
|
||||||
console.log("if currentDate > nextTrySendDate");
|
|
||||||
try {
|
try {
|
||||||
await this.sendEmail(email);
|
await this.sendEmail(email);
|
||||||
email.sentAt = currentDate;
|
email.sentAt = currentDate;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
email.lastTrySendDate = currentDate;
|
email.lastTrySendDate = currentDate;
|
||||||
email.nbTrySend = email.nbTrySend! + 1;
|
email.nbTrySend = email.nbTrySend! + 1;
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
await this.update(email.uid, email);
|
await this.update(email.uid, email);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user