re-use existing processed data
Do not save the error unless it occurs.
This commit is contained in:
parent
87cac58d57
commit
e72f37bff2
1 changed files with 12 additions and 2 deletions
14
scripts/external/processor.js
vendored
14
scripts/external/processor.js
vendored
|
@ -15,13 +15,23 @@ export default class processor {
|
|||
}
|
||||
|
||||
async analyze() {
|
||||
this.product = new product(this.data);
|
||||
// Do not reset the product data, just re-use it.
|
||||
this.product = (!this.product) ? new product(this.data) : this.product;
|
||||
await this.product.attach();
|
||||
|
||||
// Set up current data of the site, but forget about its previous errored state.
|
||||
this.product.status[`done`] = false;
|
||||
delete this.product.status[`error`];
|
||||
|
||||
// First save the SHA512 summary of the scraped data.
|
||||
this.product.save();
|
||||
|
||||
// Try analysis of the data.
|
||||
try {
|
||||
await this.product.analyze();
|
||||
} catch(err) {
|
||||
logging.error(err.name, err.message, err.stack, false);
|
||||
this.product.status[`error`] = true;
|
||||
this.product.status[`error`] = err;
|
||||
};
|
||||
|
||||
// Indicate that the process is done.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue