Skip to content
Open
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
59 changes: 0 additions & 59 deletions src/EasyCaching.Core/DistributedLock/RefCounter.cs

This file was deleted.

45 changes: 6 additions & 39 deletions src/EasyCaching.Core/EasyCachingAbstractBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,53 +28,31 @@ public abstract class EasyCachingAbstractBus : IEasyCachingBus
public void Publish(string topic, EasyCachingMessage message)
{
var operationId = s_diagnosticListener.WritePublishMessageBefore(new BeforePublishMessageRequestEventData(topic, message));
Exception e = null;
try
{
BasePublish(topic, message);
}
catch (Exception ex)
{
e = ex;
s_diagnosticListener.WritePublishMessageError(operationId, ex);
throw;
}
finally
{
if (e != null)
{
s_diagnosticListener.WritePublishMessageError(operationId, e);
}
else
{
s_diagnosticListener.WritePublishMessageAfter(operationId);
}
}
s_diagnosticListener.WritePublishMessageAfter(operationId);
}

public async Task PublishAsync(string topic, EasyCachingMessage message, CancellationToken cancellationToken = default(CancellationToken))
{
var operationId = s_diagnosticListener.WritePublishMessageBefore(new BeforePublishMessageRequestEventData(topic, message));
Exception e = null;
try
{
await BasePublishAsync(topic, message, cancellationToken);
}
catch (Exception ex)
{
e = ex;
s_diagnosticListener.WritePublishMessageError(operationId, ex);
throw;
}
finally
{
if (e != null)
{
s_diagnosticListener.WritePublishMessageError(operationId, e);
}
else
{
s_diagnosticListener.WritePublishMessageAfter(operationId);
}
}
s_diagnosticListener.WritePublishMessageAfter(operationId);
}

public void Subscribe(string topic, Action<EasyCachingMessage> action, Action reconnectAction)
Expand All @@ -94,27 +72,16 @@ public void Subscribe(string topic, Action<EasyCachingMessage> action, Action re
public virtual void BaseOnMessage(EasyCachingMessage message)
{
var operationId = s_diagnosticListener.WriteSubscribeMessageBefore(new BeforeSubscribeMessageRequestEventData(message));
Exception e = null;
try
{
_handler?.Invoke(message);
}
catch (Exception ex)
{
e = ex;
s_diagnosticListener.WritePublishMessageError(operationId, ex);
throw;
}
finally
{
if (e != null)
{
s_diagnosticListener.WritePublishMessageError(operationId, e);
}
else
{
s_diagnosticListener.WritePublishMessageAfter(operationId);
}
}
s_diagnosticListener.WritePublishMessageAfter(operationId);
}

public virtual void BaseOnReconnect()
Expand Down
Loading
Loading