use of com.bakdata.conquery.models.messages.namespaces.specific.CancelQuery in project conquery by bakdata.
the class QueryProcessor method cancel.
/**
* Cancel a running query: Sending cancellation to shards, which will cause them to stop executing them, results are not sent back, and incoming results will be discarded.
*/
public void cancel(Subject subject, Dataset dataset, ManagedExecution<?> query) {
// Does not make sense to cancel a query that isn't running.
if (!query.getState().equals(ExecutionState.RUNNING)) {
return;
}
log.info("User[{}] cancelled Query[{}]", subject.getId(), query.getId());
final Namespace namespace = getDatasetRegistry().get(dataset.getId());
query.reset();
namespace.sendToAll(new CancelQuery(query.getId()));
}
Aggregations