(cherry picked from commit bb7b2808e2f70389157408809ec47cc8860b4938)pull/9178/head
parent
7d85922f8d
commit
dce637905a
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace NzbDrone.Common.TPL
|
||||||
|
{
|
||||||
|
public interface IDebounceManager
|
||||||
|
{
|
||||||
|
Debouncer CreateDebouncer(Action action, TimeSpan debounceDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DebounceManager : IDebounceManager
|
||||||
|
{
|
||||||
|
public Debouncer CreateDebouncer(Action action, TimeSpan debounceDuration)
|
||||||
|
{
|
||||||
|
return new Debouncer(action, debounceDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using NzbDrone.Common.TPL;
|
||||||
|
|
||||||
|
namespace NzbDrone.Test.Common
|
||||||
|
{
|
||||||
|
public class MockDebouncer : Debouncer
|
||||||
|
{
|
||||||
|
public MockDebouncer(Action action, TimeSpan debounceDuration)
|
||||||
|
: base(action, debounceDuration)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Execute()
|
||||||
|
{
|
||||||
|
lock (_timer)
|
||||||
|
{
|
||||||
|
_action();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue