Skip to content

Commit f864e8a

Browse files
authored
Correct Preconditions error message in WorkerFactory (#2693)
Correct Preconditions message for WorkerFactory#start The original code had `State.Initial.name()` duplicated in the error message, which was likely a copy-paste error. The fix correctly shows `State.Initial` and `State.Started` as the expected states.
1 parent 850515b commit f864e8a

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

temporal-sdk/src/main/java/io/temporal/worker/WorkerFactory.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.google.common.base.Strings;
66
import com.uber.m3.tally.Scope;
77
import io.temporal.api.workflowservice.v1.DescribeNamespaceRequest;
8-
import io.temporal.api.workflowservice.v1.DescribeNamespaceResponse;
98
import io.temporal.client.WorkflowClient;
109
import io.temporal.client.WorkflowClientOptions;
1110
import io.temporal.common.converter.DataConverter;
@@ -196,21 +195,21 @@ public synchronized void start() {
196195
statusErrorMessage,
197196
"start WorkerFactory",
198197
state.name(),
199-
String.format("%s, %s", State.Initial.name(), State.Initial.name())));
198+
String.format("%s, %s", State.Initial.name(), State.Started.name())));
199+
200200
if (state == State.Started) {
201201
return;
202202
}
203203

204204
// Workers check and require that Temporal Server is available during start to fail-fast in case
205205
// of configuration issues.
206-
DescribeNamespaceResponse response =
207-
workflowClient
208-
.getWorkflowServiceStubs()
209-
.blockingStub()
210-
.describeNamespace(
211-
DescribeNamespaceRequest.newBuilder()
212-
.setNamespace(workflowClient.getOptions().getNamespace())
213-
.build());
206+
workflowClient
207+
.getWorkflowServiceStubs()
208+
.blockingStub()
209+
.describeNamespace(
210+
DescribeNamespaceRequest.newBuilder()
211+
.setNamespace(workflowClient.getOptions().getNamespace())
212+
.build());
214213

215214
for (Worker worker : workers.values()) {
216215
worker.start();

0 commit comments

Comments
 (0)