Scraping Fixes

- Fixed bugs with scraping graphql endpoint
- Added traceID to logging for jobs
This commit is contained in:
Wyatt Johnson
2018-03-07 15:30:34 -07:00
parent 98facd1019
commit 435067f619
7 changed files with 27 additions and 30 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ class Context {
this.id = ctx.id || uuid.v4();
// Attach a logger or create one.
this.log = ctx.log || createLogger('context', this.id);
this.log = ctx.log || createLogger('graph:context', this.id);
// Load the current logged in user to `user`, otherwise this will be null.
this.user = get(ctx, 'user');
+1 -1
View File
@@ -119,7 +119,7 @@ const findOrCreateAssetByURL = async (ctx, url) => {
// If this is a new asset, then we need to scrape it!
if (!asset.scraped) {
// Create the Scraper job.
await Scraper.create(asset);
await Scraper.create(ctx, asset.id);
}
return asset;
+2 -2
View File
@@ -63,9 +63,9 @@ const closeNow = async (ctx, id) =>
* @param {String} id the asset's id to scrape
*/
const scrapeAsset = async (ctx, id) => {
const { services: { Scraper } } = ctx;
const { connectors: { services: { Scraper } } } = ctx;
return Scraper.create({ id });
return Scraper.create(ctx, id);
};
module.exports = ctx => {