Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that restart delay is set before any other activity is executed #18547

Merged
merged 3 commits into from
Oct 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ public class ConnectionManagerWorkflowImpl implements ConnectionManagerWorkflow
private static final int RECORD_METRIC_CURRENT_VERSION = 1;
private static final String WORKFLOW_CONFIG_TAG = "workflow_config";
private static final int WORKFLOW_CONFIG_CURRENT_VERSION = 1;
private static final String WORKFLOW_DELAY_TAG = "get_workflow_delay";
private static final int WORKFLOW_DELAY_TAG_CURRENT_VERSION = 1;

private static final String ROUTE_ACTIVITY_TAG = "route_activity";
private static final int ROUTE_ACTIVITY_CURRENT_VERSION = 1;
Expand Down Expand Up @@ -161,8 +163,14 @@ public class ConnectionManagerWorkflowImpl implements ConnectionManagerWorkflow
public void run(final ConnectionUpdaterInput connectionUpdaterInput) throws RetryableException {
try {
ApmTraceUtils.addTagsToTrace(Map.of(CONNECTION_ID_KEY, connectionUpdaterInput.getConnectionId()));
recordMetric(new RecordMetricInput(connectionUpdaterInput, Optional.empty(), OssMetricsRegistry.TEMPORAL_WORKFLOW_ATTEMPT, null));
workflowDelay = getWorkflowRestartDelaySeconds();
if (Workflow.getVersion(WORKFLOW_DELAY_TAG, Workflow.DEFAULT_VERSION,
WORKFLOW_DELAY_TAG_CURRENT_VERSION) < WORKFLOW_DELAY_TAG_CURRENT_VERSION) {
recordMetric(new RecordMetricInput(connectionUpdaterInput, Optional.empty(), OssMetricsRegistry.TEMPORAL_WORKFLOW_ATTEMPT, null));
workflowDelay = getWorkflowRestartDelaySeconds();
} else {
workflowDelay = getWorkflowRestartDelaySeconds();
recordMetric(new RecordMetricInput(connectionUpdaterInput, Optional.empty(), OssMetricsRegistry.TEMPORAL_WORKFLOW_ATTEMPT, null));
}

try {
cancellableSyncWorkflow = generateSyncWorkflowRunnable(connectionUpdaterInput);
Expand Down