Skip to content

Commit

Permalink
Merge 810da3d into 9debf2d
Browse files Browse the repository at this point in the history
  • Loading branch information
Pchelolo authored May 22, 2019
2 parents 9debf2d + 810da3d commit 0732513
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"mediawiki-title": "^0.6.5",
"restbase-mod-table-cassandra": "^1.1.3",
"semver": "latest",
"service-runner": "^2.6.17"
"service-runner": "^2.6.17",
"extend": "^3.0.2"
},
"devDependencies": {
"ajv": "^6.10.0",
Expand Down
9 changes: 8 additions & 1 deletion sys/parsoid.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

const P = require('bluebird');
const extend = require('extend');
const HyperSwitch = require('hyperswitch');
const URI = HyperSwitch.URI;
const HTTPError = HyperSwitch.HTTPError;
Expand Down Expand Up @@ -339,7 +340,13 @@ class ParsoidService {
.catch({ status: 404 }, () =>
grabContentFromOldLatestBucket()
.tap((res) => {
this.saveParsoidResultToLatest(hyper, domain, title, res)
// Since we're saving the result completely asyncronously without
// returning a promise, we need to clone the response object.
// By the time we get to storing the result, it was already
// returned to the client and all the response headers
// were set, thus the `.html` part contains full set of response headers.
const resToSave = extend(true, {}, res);
this.saveParsoidResultToLatest(hyper, domain, title, resToSave)
.catch((e) => hyper.logger.log('parsoid/copyover', {
msg: 'Failed to copy latest Parsoid data',
e
Expand Down

0 comments on commit 0732513

Please sign in to comment.