Merge pull request #16915 from mozilla/no-cloud-scheduler

chore(build): comment out a `require` that leads to a pure ESM module
This commit is contained in:
Barry Chen 2024-05-09 16:37:53 -05:00 коммит произвёл GitHub
Родитель 5fc55b4c41 43c9c2c29f
Коммит 60fa969bc2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 28 добавлений и 23 удалений

Просмотреть файл

@ -4,13 +4,16 @@
import { ConfigType } from '../../config';
import { AuthLogger, AuthRequest } from '../types';
import { processDateRange } from '../../scripts/delete-unverified-accounts';
// commenting this out for now because the script uses p-queue, which is pure
// ESM since 7.x. That won't work when nodejs try to `require` it.
// import { processDateRange } from '../../scripts/delete-unverified-accounts';
import {
AccountTasks,
AccountTasksFactory,
ReasonForDeletion,
// ReasonForDeletion,
} from '@fxa/shared/cloud-tasks';
import { StatsD } from 'hot-shots';
import error from '../error';
const MILLISECONDS_IN_A_DAY = 24 * 60 * 60 * 1000;
@ -30,28 +33,30 @@ export class CloudSchedulerHandler {
}
async deleteUnverifiedAccounts() {
const { sinceDays, durationDays, taskLimit } =
this.config.cloudScheduler.deleteUnverifiedAccounts;
const endDate = this.calculateDate(sinceDays);
const startDate = this.calculateDate(sinceDays + durationDays);
const reason = ReasonForDeletion.Unverified;
return error.featureNotEnabled();
this.log.info('Deleting unverified accounts', {
initiatedAt: new Date().toISOString(),
endDate: endDate.toISOString(),
startDate: startDate.toISOString(),
});
this.statsd.increment('cloud-scheduler.deleteUnverifiedAccounts');
await processDateRange(
this.config,
this.accountTasks,
reason,
startDate.getTime(),
endDate.getTime(),
taskLimit
);
// const { sinceDays, durationDays, taskLimit } =
// this.config.cloudScheduler.deleteUnverifiedAccounts;
// const endDate = this.calculateDate(sinceDays);
// const startDate = this.calculateDate(sinceDays + durationDays);
// const reason = ReasonForDeletion.Unverified;
return {};
// this.log.info('Deleting unverified accounts', {
// initiatedAt: new Date().toISOString(),
// endDate: endDate.toISOString(),
// startDate: startDate.toISOString(),
// });
// this.statsd.increment('cloud-scheduler.deleteUnverifiedAccounts');
// await processDateRange(
// this.config,
// this.accountTasks,
// reason,
// startDate.getTime(),
// endDate.getTime(),
// taskLimit
// );
// return {};
}
}

Просмотреть файл

@ -3,7 +3,7 @@ const assert = { ...sinon.assert, ...require('chai').assert };
import { ReasonForDeletion } from '@fxa/shared/cloud-tasks';
import proxyquire from 'proxyquire';
describe('CloudSchedulerHandler', function () {
describe.skip('CloudSchedulerHandler', function () {
this.timeout(10000);
let cloudSchedulerHandler;