Preparing to save results to db

This commit is contained in:
Nedim Uka
2019-06-20 14:51:14 +02:00
parent c8ee848f0e
commit 1bcc5e8e5d
5 changed files with 40 additions and 13 deletions

View File

@@ -110,8 +110,6 @@ module.exports = class OlxCrawler {
return null;
}
async indexPage(url, maxResults = 1000) {
try {
// console.log('Starting to index page: ' + pageNr);
@@ -138,7 +136,7 @@ module.exports = class OlxCrawler {
if (singleData) {
results.push(singleData);
}
await this.sleep(500);
// await this.sleep(500);
}
return results;
@@ -177,7 +175,7 @@ module.exports = class OlxCrawler {
let result = await this.indexPage(url, maxResults);
// Object.assign(results, result)
results.push(result);
await this.sleep(5000);
// await this.sleep(5000);
}
return results;
}

View File

@@ -0,0 +1,10 @@
// const db = require('../../models/index');
// const bulkInsert = async (reuslts) => {
// db.MarketAlert.bulkCreate({
// })
// }

View File

@@ -7,7 +7,7 @@ const currentRERequest = async (req) => {
const request = await db.RealEstateRequest.findOne({ where: {uniqueId} });
return request;
};
// TODO Fetch only subscribed realestate requests
const allRERequest = async () => {
return await db.RealEstateRequest.findAll();
}