Funcionan las suspensiones
This commit is contained in:
@@ -8,6 +8,9 @@ import { OrderRepository } from "sim-shared/infrastructure/OrderRepository.js"
|
||||
import { TaskVolcadoLineas } from "./tasks/volcado_lineas.js"
|
||||
import { ObjeniousLinesRepository } from "./infranstructure/ObjeniousLinesRepository.js"
|
||||
import { postgresClientIntranet } from "./config/intranetPostgresConfig.js"
|
||||
import { PauseCancelTaskRepository } from "packages/sim-consumidor-objenious/infrastructure/PauseCancelTaskRepository.js"
|
||||
import { PauseTerminateTask } from "./tasks/check_pause_terminate.js"
|
||||
import { SimUseCases } from "packages/sim-consumidor-objenious/aplication/Sim.usecases.js"
|
||||
|
||||
async function startCron() {
|
||||
const commonSettings = {
|
||||
@@ -44,6 +47,21 @@ async function startCron() {
|
||||
objeniosRepo
|
||||
)
|
||||
|
||||
const pauseRepo = new PauseCancelTaskRepository(pgClient)
|
||||
const simUsecases = new SimUseCases({
|
||||
httpClient: httpClient,
|
||||
operationRepository: operationRepository,
|
||||
orderRepository: orderRepository,
|
||||
pauseRepository: pauseRepo
|
||||
})
|
||||
|
||||
const pauseTask = new PauseTerminateTask(
|
||||
objeniosRepo,
|
||||
pauseRepo,
|
||||
simUsecases,
|
||||
orderRepository
|
||||
)
|
||||
|
||||
const PERIODO_PETICIONES = 10 * 60 * 1000
|
||||
const interval = setInterval(async () => {
|
||||
try {
|
||||
@@ -62,7 +80,12 @@ async function startCron() {
|
||||
}
|
||||
}, PERIODO_VOLCADO)
|
||||
|
||||
await volcadoLineasTask.loadLines()
|
||||
|
||||
//await pauseTask.run()
|
||||
const PERIODO_CANCELACIONES = 24 * 60 * 60 * 1000;
|
||||
const clacelacionesInterval = setInterval(async () => {
|
||||
await pauseTask.run()
|
||||
}, PERIODO_CANCELACIONES)
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const logger =
|
||||
}
|
||||
|
||||
|
||||
export class TaskPauseTerminate {
|
||||
export class PauseTerminateTask {
|
||||
constructor(
|
||||
private readonly objeniousRepo: ObjeniousOperationsRepository,
|
||||
private readonly pauseRepo: PauseCancelTaskRepository,
|
||||
|
||||
Reference in New Issue
Block a user