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

add request timeout #78 #79

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/DtmCommon/Imp/TransBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class TransBase

[JsonPropertyName("timeout_to_fail")]
public long TimeoutToFail { get; set; }
[JsonPropertyName("request_timeout")]
public long RequestTimeout { get; set; }

[JsonPropertyName("retry_interval")]
public long RetryInterval { get; set; }
Expand Down
11 changes: 10 additions & 1 deletion src/Dtmcli/Saga/Saga.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,16 @@ public Saga SetTimeoutToFail(long timeoutToFail)
this._transBase.TimeoutToFail = timeoutToFail;
return this;
}

/// <summary>
/// Set request timeout
/// </summary>
/// <param name="requestTimeout">request timeout</param>
/// <returns></returns>
public Saga SetRequestTimeout(long requestTimeout)
{
this._transBase.RequestTimeout = requestTimeout;
return this;
}
/// <summary>
/// Set retry interval for trans, unit is second
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions src/Dtmgrpc/DtmGImp/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public static dtmgpb.DtmRequest BuildDtmRequest(TransBase transBase)
TimeoutToFail = transBase.TimeoutToFail,
RetryInterval = transBase.RetryInterval,
RetryLimit = transBase.RetryLimit,
RequestTimeout = transBase.RequestTimeout,
};

if (transBase.BranchHeaders != null)
Expand Down
10 changes: 10 additions & 0 deletions src/Dtmgrpc/Saga/SagaGrpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ public SagaGrpc SetTimeoutToFail(long timeoutToFail)
this._transBase.TimeoutToFail = timeoutToFail;
return this;
}
/// <summary>
/// Set request timeout
/// </summary>
/// <param name="requestTimeout">request timeout</param>
/// <returns></returns>
public SagaGrpc SetRequestTimeout(long requestTimeout)
{
this._transBase.RequestTimeout = requestTimeout;
return this;
}

/// <summary>
/// Set retry interval for trans, unit is second
Expand Down
Loading