Skip to content

Commit dcc5373

Browse files
authored
Use latest halibut (#1123)
* Use latest halibut * Use IsRetryAble instead of IsNetworkError, so halibut has more control over what it wants to allow
1 parent 9e5c55a commit dcc5373

File tree

7 files changed

+17
-79
lines changed

7 files changed

+17
-79
lines changed

source/Octopus.Tentacle.Client/Retries/RpcCallRetryPolicyBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async Task DefaultOnTimeoutAction(Context context, TimeSpan timeout, Task task,
5353
public AsyncPolicy BuildRetryPolicy()
5454
{
5555
var handleAndRetryPolicy = Policy
56-
.Handle<HalibutClientException>(exceptionPredicate: ex => ex.IsNetworkError() != HalibutNetworkExceptionType.NotANetworkError)
56+
.Handle<HalibutClientException>(exceptionPredicate: ex => ex.IsRetryableError() != HalibutRetryableErrorType.NotRetryable)
5757
.WaitAndRetryAsync(
5858
retryCount: int.MaxValue,
5959
sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(Math.Min(retryAttempt, 10)),

source/Octopus.Tentacle.Contracts/Octopus.Tentacle.Contracts.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</Otherwise>
2929
</Choose>
3030
<ItemGroup>
31-
<PackageReference Include="Halibut" Version="8.1.1040" />
31+
<PackageReference Include="Halibut" Version="8.1.1423" />
3232
</ItemGroup>
3333
<ItemGroup>
3434
<Compile Include="..\Solution Items\SolutionInfo.cs">

source/Octopus.Tentacle.Tests.Integration.Common/Logging/TestContextConnectionLog.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ public class TestContextConnectionLog : ILog, ILogWriter
1212
readonly string endpoint;
1313
readonly string name;
1414
readonly LogLevel logLevel;
15+
readonly Type? forContext;
1516

16-
public TestContextConnectionLog(string endpoint, string name, LogLevel logLevel)
17+
public TestContextConnectionLog(string endpoint, string name, LogLevel logLevel, Type? forContext = null)
1718
{
1819
this.endpoint = endpoint;
1920
this.name = name;
2021
this.logLevel = logLevel;
22+
this.forContext = forContext;
2123
}
2224

2325
public void Write(EventType type, string message, params object?[] args)
@@ -35,15 +37,20 @@ public IList<LogEvent> GetLogs()
3537
throw new NotImplementedException();
3638
}
3739

40+
public ILog ForContext<T>()
41+
{
42+
return new TestContextConnectionLog(endpoint, name, logLevel, typeof(T));
43+
}
44+
3845
void WriteInternal(LogEvent logEvent)
3946
{
4047
var logEventLogLevel = GetLogLevel(logEvent);
4148

4249
if (logEventLogLevel >= logLevel)
4350
{
44-
new SerilogLoggerBuilder().Build()
45-
.ForContext<TestContextConnectionLog>()
46-
.Write(GetSerilogLevel(logEvent), string.Format("{5, 16}: {0}:{1} {2} {3} {4}", logEventLogLevel, logEvent.Error, endpoint, Thread.CurrentThread.ManagedThreadId, logEvent.FormattedMessage, name));
51+
var logger = new SerilogLoggerBuilder().Build();
52+
logger = forContext != null ? logger.ForContext(forContext) : logger.ForContext<TestContextConnectionLog>();
53+
logger.Write(GetSerilogLevel(logEvent), string.Format("{5, 16}: {0}:{1} {2} {3} {4}", logEventLogLevel, logEvent.Error, endpoint, Thread.CurrentThread.ManagedThreadId, logEvent.FormattedMessage, name));
4754
}
4855
}
4956

source/Octopus.Tentacle.Tests.Integration/Support/Logging/TestContextConnectionLog.cs

Lines changed: 0 additions & 70 deletions
This file was deleted.

source/Octopus.Tentacle.Tests.Integration/Support/Logging/TestContextLogCreator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using Halibut.Diagnostics.LogCreators;
33
using Halibut.Logging;
4+
using Octopus.Tentacle.Tests.Integration.Common.Logging;
45
using ILog = Halibut.Diagnostics.ILog;
56

67
namespace Octopus.Tentacle.Tests.Integration.Support.Logging

source/Octopus.Tentacle.Tests.Integration/Support/PendingRequestQueueFactories/CancelWhenRequestQueuedPendingRequestQueueFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public Decorator(IPendingRequestQueue inner, CancellationTokenSource cancellatio
4444

4545
public bool IsEmpty => inner.IsEmpty;
4646
public int Count => inner.Count;
47-
public async Task ApplyResponse(ResponseMessage response, ServiceEndPoint destination) => await inner.ApplyResponse(response, destination);
47+
public async Task ApplyResponse(ResponseMessage response, Guid activityId) => await inner.ApplyResponse(response, activityId);
4848
public async Task<RequestMessageWithCancellationToken?> DequeueAsync(CancellationToken cancellationToken) => await inner.DequeueAsync(cancellationToken);
4949

5050
public async Task<ResponseMessage> QueueAndWaitAsync(RequestMessage request, CancellationToken cancellationTokens)

source/Octopus.Tentacle.Tests.Integration/Util/PendingRequestQueueHelpers/CancellationTokenObservingPendingRequestQueueDecorator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public CancellationTokenObservingPendingRequestQueueDecorator(IPendingRequestQue
1616
this.pendingRequestQueue = pendingRequestQueue;
1717
}
1818

19-
public async Task ApplyResponse(ResponseMessage response, ServiceEndPoint destination)
19+
public async Task ApplyResponse(ResponseMessage response, Guid activityId)
2020
{
21-
await pendingRequestQueue.ApplyResponse(response, destination);
21+
await pendingRequestQueue.ApplyResponse(response, activityId);
2222
}
2323

2424
public async Task<RequestMessageWithCancellationToken> DequeueAsync(CancellationToken cancellationToken)

0 commit comments

Comments
 (0)