Skip to content

Commit

Permalink
fix: relax post consume callback error handling
Browse files Browse the repository at this point in the history
timed out responses will no more result in error user notifications
  • Loading branch information
lgersman committed Sep 30, 2022
1 parent 5b6a44e commit c309d1b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion impex-cli/impex-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ function ($curl) use ($slice, $slice_contents, $chunk_dir, $slice_file, $options
);

if ($error) {
_die($options, "Creating import snapshot failed : HTTP status(=%s) : %s", $status, $error);
_log($options, "Warning : Failed to update metadata : HTTP status(=%s) : %s", $status, $error);
}
}

Expand Down
13 changes: 13 additions & 0 deletions plugins/cm4all-wp-impex/src/wp.impex.store.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,26 @@ export default async function (settings) {
path : `${settings.base_uri}/${callback.path}`,
method: callback.method,
data: callback.data,
}).catch(error => {
// silently ignore errors from timed out metadata updates
if(error.code==='fetch_error') {
log.push({
type: 'warning',
message : `Ignore post consume callback(='${callback.path}') response : server side timed out(data=${JSON.stringify(callback.data)})`,
cause : [],
});
return Promise.resolve();
}
})
);

await Promise.all(postConsumeCallbacks);

debug("consumeImport(%o, %o, %s, %o).log=\n%o", id, JSON.stringify(options), offset, limit, log);

return {
type: "",
payload: { log, notConsumedSlices },
};
},
setImports(exports) {
Expand Down

0 comments on commit c309d1b

Please sign in to comment.