Skip to content

Commit

Permalink
Cleanup dead state machines code
Browse files Browse the repository at this point in the history
State Machine Rewrite #172 left a couple of state machine code in the class that is not responsible for handling state transitions anymore and this code is not invoked.
  • Loading branch information
Spikhalskiy committed Jul 7, 2022
1 parent 1bea19c commit 9abacf2
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 28 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
id 'org.cadixdev.licenser' version '0.6.1'
id 'com.palantir.git-version' version "${palantirGitVersionVersion}" apply false
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'com.diffplug.spotless' version '6.7.2' apply false
id 'com.diffplug.spotless' version '6.8.0' apply false
id 'base'
}

Expand Down
5 changes: 3 additions & 2 deletions gradle/linting.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ subprojects {
}

kotlin {
ktlint('0.44.0')
ktlint('0.46.1')
.setUseExperimental(true)
// needs to be aligned with .editorconfig
// https://github.com/diffplug/spotless/tree/main/plugin-gradle#ktlint
.userData(['indent_size': '2'])
// reenable filename rule after https://github.com/pinterest/ktlint/issues/1521
.editorConfigOverride(['indent_size': '2', 'disabled_rules': 'filename'])
}
}

Expand Down
2 changes: 2 additions & 0 deletions temporal-kotlin/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[*.{kt,kts}]
indent_size = 2
# reenable filename rule after https://github.com/pinterest/ktlint/issues/1521
disabled_rules = filename
2 changes: 1 addition & 1 deletion temporal-opentracing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies {
testImplementation "junit:junit:${junitVersion}"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testImplementation group: 'io.opentracing', name: 'opentracing-mock', version: "$opentracingVersion"
testImplementation group: 'io.jaegertracing', name: 'jaeger-client', version: '1.8.0'
testImplementation group: 'io.jaegertracing', name: 'jaeger-client', version: '1.8.1'

testRuntimeOnly group: 'ch.qos.logback', name: 'logback-classic', version: "${logbackVersion}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@
import io.temporal.api.common.v1.SearchAttributes;
import io.temporal.api.common.v1.WorkflowExecution;
import io.temporal.api.common.v1.WorkflowType;
import io.temporal.api.enums.v1.WorkflowTaskFailedCause;
import io.temporal.api.failure.v1.Failure;
import io.temporal.api.history.v1.HistoryEvent;
import io.temporal.api.history.v1.WorkflowExecutionStartedEventAttributes;
import io.temporal.api.history.v1.WorkflowTaskFailedEventAttributes;
import io.temporal.common.context.ContextPropagator;
import io.temporal.failure.CanceledFailure;
import io.temporal.internal.common.ProtobufTimeUtils;
Expand Down Expand Up @@ -327,14 +325,6 @@ public long currentTimeMillis() {
return workflowStateMachines.currentTimeMillis();
}

public void handleWorkflowTaskFailed(HistoryEvent event) {
WorkflowTaskFailedEventAttributes attr = event.getWorkflowTaskFailedEventAttributes();
if (attr != null
&& attr.getCause() == WorkflowTaskFailedCause.WORKFLOW_TASK_FAILED_CAUSE_RESET_WORKFLOW) {
workflowContext.setCurrentRunId(attr.getNewRunId());
}
}

@Override
public void upsertSearchAttributes(SearchAttributes searchAttributes) {
workflowStateMachines.upsertSearchAttributes(searchAttributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ final class WorkflowContext {
private ContinueAsNewWorkflowExecutionCommandAttributes continueAsNewOnCompletion;
private final WorkflowExecutionStartedEventAttributes startedAttributes;
private final String namespace;
// RunId can change when reset happens. This remembers the actual runId that is used as in this
// particular part of the history.
private String currentRunId;
private SearchAttributes.Builder searchAttributes;
private final List<ContextPropagator> contextPropagators;
@Nonnull private final WorkflowExecution workflowExecution;
Expand All @@ -62,7 +59,6 @@ final class WorkflowContext {
this.namespace = namespace;
this.workflowExecution = Preconditions.checkNotNull(workflowExecution);
this.startedAttributes = startedAttributes;
this.currentRunId = startedAttributes.getOriginalExecutionRunId();
if (startedAttributes.hasSearchAttributes()) {
this.searchAttributes = startedAttributes.getSearchAttributes().toBuilder();
}
Expand Down Expand Up @@ -142,14 +138,6 @@ private WorkflowExecutionStartedEventAttributes getWorkflowStartedEventAttribute
return startedAttributes;
}

void setCurrentRunId(String currentRunId) {
this.currentRunId = currentRunId;
}

String getCurrentRunId() {
return currentRunId;
}

public Map<String, Payload> getHeader() {
return startedAttributes.getHeader().getFieldsMap();
}
Expand Down
2 changes: 1 addition & 1 deletion temporal-serviceclient/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.google.protobuf' version '0.8.18'
id 'com.google.protobuf' version '0.8.19'
}

apply plugin: 'idea' // IntelliJ plugin to see files generated from protos
Expand Down
2 changes: 1 addition & 1 deletion temporal-test-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
id 'application'
id 'com.palantir.graal' version "${graalVersion}"
id 'com.palantir.docker' version '0.34.0'
id 'com.google.protobuf' version '0.8.18'
id 'com.google.protobuf' version '0.8.19'
}

apply plugin: 'idea' // IntelliJ plugin to see files generated from protos
Expand Down

0 comments on commit 9abacf2

Please sign in to comment.