-
Notifications
You must be signed in to change notification settings - Fork 26
Conversation
f5cc60e
to
8a1fd20
Compare
src/Microsoft.Azure.WebJobs.Extensions.EventHubs/Listeners/EventHubListener.cs
Show resolved
Hide resolved
src/Microsoft.Azure.WebJobs.Extensions.EventHubs/Listeners/EventHubListener.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks okay to me -- maybe @sidkri wants to double-check as well?
// Host for the EventHubListener have beed disposed, | ||
// the invocation(s) can be uncompleted in this case | ||
// and we do not to checkpoint to avoid possible data lose | ||
_logger.LogDebug(GetOperationDetails(context, "SkipCheckpointDueHostDisposed")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: SkipCheckpointDueToHostDisposed
{ | ||
await CheckpointAsync(context); | ||
// Host for the EventHubListener have beed disposed, | ||
// the invocation(s) can be uncompleted in this case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than saying "uncompleted", could you comment that we expect function invocations to fail before reaching customer code and so the checkpoint should not be advanced?
src/Microsoft.Azure.WebJobs.Extensions.EventHubs/Listeners/EventHubListener.cs
Outdated
Show resolved
Hide resolved
@@ -308,7 +308,7 @@ public async Task ProcessEvents_SingleDispatch_SystemPropertiesAndApplicationPro | |||
var loggerMock = new Mock<ILogger>(); | |||
var executor = new Mock<ITriggeredFunctionExecutor>(MockBehavior.Strict); | |||
executor.Setup(p => p.TryExecuteAsync(It.IsAny<TriggeredFunctionData>(), It.IsAny<CancellationToken>())).ReturnsAsync(new FunctionResult(true)); | |||
var eventProcessor = new EventHubListener.EventProcessor(options, executor.Object, loggerMock.Object, true, checkpointer.Object); | |||
var eventProcessor = new EventHubListener.EventProcessor(options, executor.Object, loggerMock.Object, true, new Mock<EventHubListener.IDisposed>().Object, checkpointer.Object); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: indenting
@@ -88,9 +91,11 @@ public async Task StopAsync(CancellationToken cancellationToken) | |||
_started = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any possibility of StopAsync() getting called concurrently ? Not sure what happens if UnregisterEventProcessorAsync() is called concurrently. We may want to add a lock around line this call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting a discussion around my comment on line 75 of EventHubListener before merging this PR.
8a1fd20
to
2787f67
Compare
2787f67
to
6d84ee8
Compare
6c9df8b
to
46b283d
Compare
private bool _started; | ||
private string _details; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readonly?
} | ||
_started = false; | ||
|
||
_logger.LogDebug($"EventHub listener stopped ({_details})"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this within the if (_started) block so we don't log on a no-op call to StopAsync() (e.g. when StopAsync is called for the second time)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternately, its fine if we want to show how many times StopAsync() was called. But in this case, we may want to log "stopped" in the if (_started) block and a different log statement in the else condition to indicate no action was needed as the listener is already stopped. This will give us better insights when debugging issues.
string functionId = "FunctionId"; | ||
string eventHubName = "EventHubName"; | ||
string consumerGroup = "ConsumerGroup"; | ||
var storageUri = new Uri("https://eventhubsteststorageaccount.blob.core.windows.net/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used, hard coded on line 246 instead. consider moving this to a class member as the same URI is used in GetMonitor_ReturnsExpectedValue() as well.
Address issue detailed in #104
Also as part of the PR I added the track2 port (6c9df8b) which helps with
Dispose_Calls_StopAsync
test and CRIs invetigations in general:Azure/azure-sdk-for-net@bad9b85