diff --git a/internal/client.go b/internal/client.go index b777082d5..73c5c2627 100644 --- a/internal/client.go +++ b/internal/client.go @@ -606,6 +606,8 @@ type ( // EnableEagerStart - request eager execution for this workflow, if a local worker is available. // + // WARNING: Do not use in combination with a versioned task queue. + // // NOTE: Experimental EnableEagerStart bool diff --git a/internal/internal_eager_workflow.go b/internal/internal_eager_workflow.go index 436f698d5..8982eae99 100644 --- a/internal/internal_eager_workflow.go +++ b/internal/internal_eager_workflow.go @@ -38,6 +38,10 @@ type eagerWorkflowDispatcher struct { // registerWorker registers a worker that can be used for eager workflow dispatch func (e *eagerWorkflowDispatcher) registerWorker(worker *workflowWorker) { + // Currently eager workflow start does not work with versioning + if worker.executionParameters.UseBuildIDForVersioning { + return + } e.lock.Lock() defer e.lock.Unlock() e.workersByTaskQueue[worker.executionParameters.TaskQueue] = append(e.workersByTaskQueue[worker.executionParameters.TaskQueue], worker.worker) diff --git a/internal/internal_eager_workflow_test.go b/internal/internal_eager_workflow_test.go index 0a6ee3954..5e46d91d5 100644 --- a/internal/internal_eager_workflow_test.go +++ b/internal/internal_eager_workflow_test.go @@ -114,3 +114,19 @@ func TestEagerWorkflowExecutor(t *testing.T) { exec.handleResponse(&workflowservice.PollWorkflowTaskQueueResponse{}) }) } + +func TestEagerWorkflowDispatchAndVersioning(t *testing.T) { + dispatcher := &eagerWorkflowDispatcher{ + workersByTaskQueue: make(map[string][]eagerWorker), + } + dispatcher.registerWorker(&workflowWorker{ + executionParameters: workerExecutionParameters{TaskQueue: "task-queue", UseBuildIDForVersioning: true}, + }) + + request := &workflowservice.StartWorkflowExecutionRequest{ + TaskQueue: &taskqueuepb.TaskQueue{Name: "task-queue"}, + } + exec := dispatcher.applyToRequest(request) + require.Nil(t, exec) + require.False(t, request.GetRequestEagerExecution()) +}