Skip to content

Commit

Permalink
fix dates
Browse files Browse the repository at this point in the history
  • Loading branch information
folland87 committed Dec 6, 2024
1 parent 32d3c4b commit 82118ea
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/jobs/sirene/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ import { getSiretStockFromPaysage } from "./get-stock";

export default async function monitorSiren(job) {
const now = new Date();
const lastSuccessfullExecution = db.collection("_jobs").find({
name: SIREN_TASK_NAME,
"result.status": "success",
});
const lastSuccessfullExecution = db
.collection("_jobs")
.find(
{
name: SIREN_TASK_NAME,
"result.status": "success",
},
{ sort: { lastFinishedAt: -1 } },
)
.toArray();
const from = lastSuccessfullExecution
? lastSuccessfullExecution.result?.lastExecution
?.toISOString()
Expand Down

0 comments on commit 82118ea

Please sign in to comment.