Skip to content

Commit 351607d

Browse files
authored
Expose continue-as-new backoff start interval (#2138)
1 parent 0bae9ce commit 351607d

11 files changed

Lines changed: 111 additions & 43 deletions

File tree

packages/core-bridge/Cargo.lock

Lines changed: 73 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core-bridge/sdk-core

Submodule sdk-core updated 344 files

packages/core-bridge/src/client.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ async fn client_invoke_workflow_service(
342342
"ListWorkflowRules" => rpc_call!(connection, call, list_workflow_rules),
343343
"PatchSchedule" => rpc_call!(connection, call, patch_schedule),
344344
"PauseActivity" => rpc_call!(connection, call, pause_activity),
345+
"PauseActivityExecution" => rpc_call!(connection, call, pause_activity_execution),
345346
"PauseWorkflowExecution" => rpc_call!(connection, call, pause_workflow_execution),
346347
"PollActivityExecution" => rpc_call!(connection, call, poll_activity_execution),
347348
"PollActivityTaskQueue" => rpc_call!(connection, call, poll_activity_task_queue),
@@ -372,6 +373,7 @@ async fn client_invoke_workflow_service(
372373
rpc_call!(connection, call, request_cancel_workflow_execution)
373374
}
374375
"ResetActivity" => rpc_call!(connection, call, reset_activity),
376+
"ResetActivityExecution" => rpc_call!(connection, call, reset_activity_execution),
375377
"ResetStickyTaskQueue" => rpc_call!(connection, call, reset_sticky_task_queue),
376378
"ResetWorkflowExecution" => rpc_call!(connection, call, reset_workflow_execution),
377379
"RespondActivityTaskCanceled" => {
@@ -425,7 +427,11 @@ async fn client_invoke_workflow_service(
425427
"TerminateWorkflowExecution" => rpc_call!(connection, call, terminate_workflow_execution),
426428
"TriggerWorkflowRule" => rpc_call!(connection, call, trigger_workflow_rule),
427429
"UnpauseActivity" => rpc_call!(connection, call, unpause_activity),
430+
"UnpauseActivityExecution" => rpc_call!(connection, call, unpause_activity_execution),
428431
"UnpauseWorkflowExecution" => rpc_call!(connection, call, unpause_workflow_execution),
432+
"UpdateActivityExecutionOptions" => {
433+
rpc_call!(connection, call, update_activity_execution_options)
434+
}
429435
"UpdateActivityOptions" => rpc_call!(connection, call, update_activity_options),
430436
"UpdateNamespace" => rpc_call!(connection, call, update_namespace),
431437
"UpdateSchedule" => rpc_call!(connection, call, update_schedule),
@@ -718,6 +724,7 @@ mod config {
718724
client_cert: pair.client_cert,
719725
client_private_key: pair.client_private_key,
720726
}),
727+
server_cert_verifier: None,
721728
}
722729
}
723730
}

packages/proto/scripts/compile-proto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const outputDir = resolve(__dirname, '../protos');
1010
const jsOutputFile = resolve(outputDir, 'json-module.js');
1111
const tempFile = resolve(outputDir, 'temp.js');
1212

13-
const protoBaseDir = resolve(__dirname, '../../core-bridge/sdk-core/crates/common/protos');
13+
const protoBaseDir = resolve(__dirname, '../../core-bridge/sdk-core/crates/protos/protos');
1414

1515
function mtime(path: string) {
1616
try {

packages/test/src/test-client-connection.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ import { grpc as grpcProto } from '@temporalio/proto';
2424
const workflowServicePackageDefinition = protoLoader.loadSync(
2525
path.resolve(
2626
__dirname,
27-
'../../core-bridge/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/service.proto'
27+
'../../core-bridge/sdk-core/crates/protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto'
2828
),
29-
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/common/protos/api_upstream')] }
29+
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/protos/protos/api_upstream')] }
3030
);
3131
const workflowServiceProtoDescriptor = grpc.loadPackageDefinition(workflowServicePackageDefinition) as any;
3232

3333
const healthServicePackageDefinition = protoLoader.loadSync(
34-
path.resolve(__dirname, '../../core-bridge/sdk-core/crates/common/protos/grpc/health/v1/health.proto')
34+
path.resolve(__dirname, '../../core-bridge/sdk-core/crates/protos/protos/grpc/health/v1/health.proto')
3535
);
3636
const healthServicePackageDescriptor = grpc.loadPackageDefinition(healthServicePackageDefinition) as any;
3737

packages/test/src/test-native-connection-headers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import { Worker } from './helpers';
1212
const workflowServicePackageDefinition = protoLoader.loadSync(
1313
path.resolve(
1414
__dirname,
15-
'../../core-bridge/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/service.proto'
15+
'../../core-bridge/sdk-core/crates/protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto'
1616
),
17-
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/common/protos/api_upstream')] }
17+
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/protos/protos/api_upstream')] }
1818
);
1919
const workflowServiceProtoDescriptor = grpc.loadPackageDefinition(workflowServicePackageDefinition) as any;
2020

@@ -26,9 +26,9 @@ test('NativeConnection passes headers provided in options', async (t) => {
2626
const packageDefinition = protoLoader.loadSync(
2727
path.resolve(
2828
__dirname,
29-
'../../core-bridge/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/service.proto'
29+
'../../core-bridge/sdk-core/crates/protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto'
3030
),
31-
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/common/protos/api_upstream')] }
31+
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/protos/protos/api_upstream')] }
3232
);
3333
const protoDescriptor = grpc.loadPackageDefinition(packageDefinition) as any;
3434

packages/test/src/test-native-connection.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,33 @@ import { RUN_INTEGRATION_TESTS, Worker } from './helpers';
1818
const workflowServicePackageDefinition = protoLoader.loadSync(
1919
path.resolve(
2020
__dirname,
21-
'../../core-bridge/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/service.proto'
21+
'../../core-bridge/sdk-core/crates/protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto'
2222
),
23-
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/common/protos/api_upstream')] }
23+
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/protos/protos/api_upstream')] }
2424
);
2525
const workflowServiceProtoDescriptor = grpc.loadPackageDefinition(workflowServicePackageDefinition) as any;
2626

2727
const operatorServicePackageDefinition = protoLoader.loadSync(
2828
path.resolve(
2929
__dirname,
30-
'../../core-bridge/sdk-core/crates/common/protos/api_upstream/temporal/api/operatorservice/v1/service.proto'
30+
'../../core-bridge/sdk-core/crates/protos/protos/api_upstream/temporal/api/operatorservice/v1/service.proto'
3131
),
32-
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/common/protos/api_upstream')] }
32+
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/protos/protos/api_upstream')] }
3333
);
3434
const operatorServiceProtoDescriptor = grpc.loadPackageDefinition(operatorServicePackageDefinition) as any;
3535

3636
const healthServicePackageDefinition = protoLoader.loadSync(
37-
path.resolve(__dirname, '../../core-bridge/sdk-core/crates/common/protos/grpc/health/v1/health.proto'),
37+
path.resolve(__dirname, '../../core-bridge/sdk-core/crates/protos/protos/grpc/health/v1/health.proto'),
3838
{ includeDirs: [] }
3939
);
4040
const healthServiceProtoDescriptor = grpc.loadPackageDefinition(healthServicePackageDefinition) as any;
4141

4242
const testServicePackageDefinition = protoLoader.loadSync(
4343
path.resolve(
4444
__dirname,
45-
'../../core-bridge/sdk-core/crates/common/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto'
45+
'../../core-bridge/sdk-core/crates/protos/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto'
4646
),
47-
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/common/protos/testsrv_upstream')] }
47+
{ includeDirs: [path.resolve(__dirname, '../../core-bridge/sdk-core/crates/protos/protos/testsrv_upstream')] }
4848
);
4949
const testServiceProtoDescriptor = grpc.loadPackageDefinition(testServicePackageDefinition) as any;
5050

packages/test/src/test-workflows.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,6 +1837,7 @@ test('continueAsNewSameWorkflow', async (t) => {
18371837
workflowType,
18381838
taskQueue: 'test',
18391839
arguments: toPayloads(defaultPayloadConverter, 'signal'),
1840+
backoffStartInterval: msToTs('1ms'),
18401841
versioningIntent: coresdk.common.VersioningIntent.UNSPECIFIED,
18411842
},
18421843
},

packages/test/src/workflows/continue-as-new-same-workflow.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
* Tests continueAsNew for the same Workflow from execute and signal handler
33
* @module
44
*/
5-
import { continueAsNew, CancellationScope, defineSignal, setHandler } from '@temporalio/workflow';
5+
import {
6+
continueAsNew,
7+
CancellationScope,
8+
defineSignal,
9+
makeContinueAsNewFunc,
10+
setHandler,
11+
} from '@temporalio/workflow';
612

713
export const continueAsNewSignal = defineSignal('continueAsNew');
814

@@ -17,7 +23,7 @@ export async function continueAsNewSameWorkflow(
1723
return;
1824
}
1925
if (continueFrom === 'execute') {
20-
await continueAsNew<typeof continueAsNewSameWorkflow>(continueTo);
26+
await makeContinueAsNewFunc<typeof continueAsNewSameWorkflow>({ backoffStartInterval: '1ms' })(continueTo);
2127
}
2228
await CancellationScope.current().cancelRequested;
2329
}

packages/workflow/src/interfaces.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,11 @@ export interface ContinueAsNewOptions {
329329
* @format {@link https://www.npmjs.com/package/ms | ms-formatted string}
330330
*/
331331
workflowTaskTimeout?: Duration;
332+
/**
333+
* Delay before the first Workflow Task of the continued run is scheduled
334+
* @format {@link https://www.npmjs.com/package/ms | ms-formatted string}
335+
*/
336+
backoffStartInterval?: Duration;
332337
/**
333338
* Non-searchable attributes to attach to next Workflow run
334339
*/

0 commit comments

Comments
 (0)