added NoOpPerformanceCounterManager for signalr so linux doesn't blowup.

pull/6/head
Keivan Beigi 11 years ago
parent 72d0b9c839
commit 5a52de7ba9

@ -147,6 +147,7 @@
<Compile Include="Extensions\ReqResExtensions.cs" />
<Compile Include="Config\SettingsModule.cs" />
<Compile Include="SignalR\BasicResourceConnection.cs" />
<Compile Include="SignalR\NoOpPerformanceCounterManager.cs" />
<Compile Include="SignalR\Serializer.cs" />
<Compile Include="SignalR\SignalrDependencyResolver.cs" />
<Compile Include="SignalR\NzbDronePersistentConnection.cs" />

@ -0,0 +1,105 @@
using System.Diagnostics;
using System.Threading;
using Microsoft.AspNet.SignalR.Infrastructure;
namespace NzbDrone.Api.SignalR
{
public class NoOpPerformanceCounterManager : IPerformanceCounterManager
{
private static readonly IPerformanceCounter noOpCounter = new NoOpPerformanceCounter();
public void Initialize(string instanceName, CancellationToken hostShutdownToken)
{
}
public IPerformanceCounter LoadCounter(string categoryName, string counterName, string instanceName, bool isReadOnly)
{
return noOpCounter;
}
public IPerformanceCounter ConnectionsConnected { get { return noOpCounter; } }
public IPerformanceCounter ConnectionsReconnected { get { return noOpCounter; } }
public IPerformanceCounter ConnectionsDisconnected { get { return noOpCounter; } }
public IPerformanceCounter ConnectionsCurrent { get { return noOpCounter; } }
public IPerformanceCounter ConnectionMessagesReceivedTotal { get { return noOpCounter; } }
public IPerformanceCounter ConnectionMessagesSentTotal { get { return noOpCounter; } }
public IPerformanceCounter ConnectionMessagesReceivedPerSec { get { return noOpCounter; } }
public IPerformanceCounter ConnectionMessagesSentPerSec { get { return noOpCounter; } }
public IPerformanceCounter MessageBusMessagesReceivedTotal { get { return noOpCounter; } }
public IPerformanceCounter MessageBusMessagesReceivedPerSec { get { return noOpCounter; } }
public IPerformanceCounter ScaleoutMessageBusMessagesReceivedPerSec { get { return noOpCounter; } }
public IPerformanceCounter MessageBusMessagesPublishedTotal { get { return noOpCounter; } }
public IPerformanceCounter MessageBusMessagesPublishedPerSec { get { return noOpCounter; } }
public IPerformanceCounter MessageBusSubscribersCurrent { get { return noOpCounter; } }
public IPerformanceCounter MessageBusSubscribersTotal { get { return noOpCounter; } }
public IPerformanceCounter MessageBusSubscribersPerSec { get { return noOpCounter; } }
public IPerformanceCounter MessageBusAllocatedWorkers { get { return noOpCounter; } }
public IPerformanceCounter MessageBusBusyWorkers { get { return noOpCounter; } }
public IPerformanceCounter MessageBusTopicsCurrent { get { return noOpCounter; } }
public IPerformanceCounter ErrorsAllTotal { get { return noOpCounter; } }
public IPerformanceCounter ErrorsAllPerSec { get { return noOpCounter; } }
public IPerformanceCounter ErrorsHubResolutionTotal { get { return noOpCounter; } }
public IPerformanceCounter ErrorsHubResolutionPerSec { get { return noOpCounter; } }
public IPerformanceCounter ErrorsHubInvocationTotal { get { return noOpCounter; } }
public IPerformanceCounter ErrorsHubInvocationPerSec { get { return noOpCounter; } }
public IPerformanceCounter ErrorsTransportTotal { get { return noOpCounter; } }
public IPerformanceCounter ErrorsTransportPerSec { get { return noOpCounter; } }
public IPerformanceCounter ScaleoutStreamCountTotal { get { return noOpCounter; } }
public IPerformanceCounter ScaleoutStreamCountOpen { get { return noOpCounter; } }
public IPerformanceCounter ScaleoutStreamCountBuffering { get { return noOpCounter; } }
public IPerformanceCounter ScaleoutErrorsTotal { get { return noOpCounter; } }
public IPerformanceCounter ScaleoutErrorsPerSec { get { return noOpCounter; } }
public IPerformanceCounter ScaleoutSendQueueLength { get { return noOpCounter; } }
}
public class NoOpPerformanceCounter : IPerformanceCounter
{
public string CounterName
{
get
{
return this.GetType().Name;
}
}
public long RawValue
{
get
{
return 0L;
}
set
{
}
}
public long Decrement()
{
return 0L;
}
public long Increment()
{
return 0L;
}
public long IncrementBy(long value)
{
return 0L;
}
public void Close()
{
}
public void RemoveInstance()
{
}
public CounterSample NextSample()
{
return CounterSample.Empty;
}
}
}

@ -1,5 +1,6 @@
using System;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Infrastructure;
using NzbDrone.Common.Composition;
namespace NzbDrone.Api.SignalR
@ -15,6 +16,7 @@ namespace NzbDrone.Api.SignalR
private SignalrDependencyResolver(IContainer container)
{
container.RegisterSingleton(typeof(IPerformanceCounterManager), typeof(NoOpPerformanceCounterManager));
_container = container;
}
@ -28,4 +30,4 @@ namespace NzbDrone.Api.SignalR
return base.GetService(serviceType);
}
}
}
}

@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Loading…
Cancel
Save