1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

added NoOpPerformanceCounterManager for signalr so linux doesn't blowup.

This commit is contained in:
Keivan Beigi 2013-07-26 17:05:33 -07:00
parent 72d0b9c839
commit 5a52de7ba9
4 changed files with 112 additions and 1 deletions

View File

@ -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" />

View File

@ -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;
}
}
}

View File

@ -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 @@ public static void Register(IContainer container)
private SignalrDependencyResolver(IContainer container)
{
container.RegisterSingleton(typeof(IPerformanceCounterManager), typeof(NoOpPerformanceCounterManager));
_container = container;
}
@ -28,4 +30,4 @@ public override object GetService(Type serviceType)
return base.GetService(serviceType);
}
}
}
}

View File

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