mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-05-04 08:39:36 -05:00
fix: filter scope for bulk ops (#1503)
* fix: scope * fix: default filter and both filter and ids * release: 1.1.5
This commit is contained in:
@@ -26,7 +26,11 @@ func (a *AdminServiceImpl) CancelTasks(ctx context.Context, req *contracts.Cance
|
||||
|
||||
externalIds := req.ExternalIds
|
||||
|
||||
if req.Filter != nil {
|
||||
if len(externalIds) != 0 && req.Filter != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "cannot provide both external ids and filter")
|
||||
}
|
||||
|
||||
if len(externalIds) == 0 && req.Filter != nil {
|
||||
var (
|
||||
statuses = []sqlcv1.V1ReadableStatusOlap{
|
||||
sqlcv1.V1ReadableStatusOlapQUEUED,
|
||||
@@ -149,7 +153,11 @@ func (a *AdminServiceImpl) ReplayTasks(ctx context.Context, req *contracts.Repla
|
||||
|
||||
externalIds := req.ExternalIds
|
||||
|
||||
if req.Filter != nil {
|
||||
if len(externalIds) != 0 && req.Filter != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "cannot provide both external ids and filter")
|
||||
}
|
||||
|
||||
if len(externalIds) == 0 && req.Filter != nil {
|
||||
var (
|
||||
statuses = []sqlcv1.V1ReadableStatusOlap{
|
||||
sqlcv1.V1ReadableStatusOlapQUEUED,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hatchet-dev/typescript-sdk",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"description": "Background task orchestration & visibility for developers",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
|
||||
@@ -92,7 +92,7 @@ export class RunsClient {
|
||||
|
||||
return this.api.v1TaskCancel(this.tenantId, {
|
||||
externalIds: opts.ids,
|
||||
filter,
|
||||
filter: !opts.ids ? filter : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ export class RunsClient {
|
||||
const filter = await this.prepareFilter(opts.filters || {});
|
||||
return this.api.v1TaskReplay(this.tenantId, {
|
||||
externalIds: opts.ids,
|
||||
filter,
|
||||
filter: !opts.ids ? filter : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,17 @@ import { hatchet } from '../hatchet-client';
|
||||
// ...
|
||||
async function main() {
|
||||
const run = cancellation.runNoWait({});
|
||||
const run1 = cancellation.runNoWait({});
|
||||
|
||||
await sleep(1000);
|
||||
|
||||
await run.cancel();
|
||||
|
||||
const res = await run.output;
|
||||
const res1 = await run1.output;
|
||||
|
||||
console.log(res);
|
||||
console.log('canceled', res);
|
||||
console.log('completed', res1);
|
||||
|
||||
await sleep(1000);
|
||||
|
||||
@@ -23,7 +26,7 @@ async function main() {
|
||||
|
||||
console.log(resReplay);
|
||||
|
||||
const run2 = cancellation.runNoWait({}, { additionalMetadata: { test: 'test' } });
|
||||
const run2 = cancellation.runNoWait({}, { additionalMetadata: { test: 'abc' } });
|
||||
const run4 = cancellation.runNoWait({}, { additionalMetadata: { test: 'test' } });
|
||||
|
||||
await sleep(1000);
|
||||
|
||||
Reference in New Issue
Block a user