Browse Source

cleanup

master
diligent 4 years ago
parent
commit
fb36436270
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      app.js

+ 2
- 2
app.js View File

@@ -51,7 +51,7 @@ agenda.define('scrape', async function (job, done) {
}
}

await collection.updateOne({ _id: _id }, { $set: { status: "done", result: properties } });
await collection.updateOne({ _id: _id }, { $set: { status: "done", result: properties, endDate: new Date() } });
console.log(`${_id} scraped.`);
return done();
} catch (err) {
@@ -201,7 +201,7 @@ app.patch("/scrapes/:id/execute", async (req, res) => {
let collection = dbo.collection('scrapes');

var o_id = new ObjectID(id);
var newvalues = { $set: { status: "pending" } };
var newvalues = { $set: { status: "pending", startDate: new Date() } };
await collection.updateOne({ _id: o_id }, newvalues);
agenda.now('scrape', { _id: o_id });
return res.status(204).json();

Loading…
Cancel
Save