Skip to content

Commit

Permalink
Use the new delete-by-query functionality for morgue delete
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Shufro committed Jan 22, 2023
1 parent f16041c commit ce0d8d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 2 additions & 4 deletions bin/morgue.js
Original file line number Diff line number Diff line change
Expand Up @@ -6343,10 +6343,8 @@ function coronerDelete(argv, config) {
}

if (aq && aq.query) {
coroner.promise('query', p.universe, p.project, aq.query).then(function(r) {
unpackQueryObjects(o, r);
return delete_fn();
}).then(std_success_cb).catch(std_failure_cb);
coroner.promise('delete_query', p.universe, p.project, aq.query,
params).then(std_success_cb).catch(std_failure_cb);
} else {
delete_fn().then(std_success_cb).catch(std_failure_cb);
}
Expand Down
10 changes: 10 additions & 0 deletions lib/coroner.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,16 @@ CoronerClient.prototype.delete_objects = function(universe, project, objects, pa
this.post("/api/delete", { universe }, p, null, callback);
};

CoronerClient.prototype.delete_query = function(universe, project, query, params, callback) {
var p = Object.assign({
universe: universe,
project: project,
query: query,
}, params);

this.post("/api/delete", { universe }, p, null, callback);
};

/*
* Find a service from its name.
*/
Expand Down

0 comments on commit ce0d8d1

Please sign in to comment.