File tree 2 files changed +7
-3
lines changed
SoundSwitch/Framework/Audio/Lister
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -107,12 +107,16 @@ public void Refresh(CancellationToken cancellationToken = default)
107
107
var playbackDevices = new Dictionary < string , DeviceFullInfo > ( ) ;
108
108
var recordingDevices = new Dictionary < string , DeviceFullInfo > ( ) ;
109
109
110
- using var registration = cancellationToken . Register ( _ => { _context . Warning ( "Cancellation received." ) ; } , null ) ;
110
+ using var registration = cancellationToken . Register ( _ =>
111
+ {
112
+ _context . Warning ( "Cancellation received." ) ;
113
+ throw new OperationCanceledException ( "Stop refreshing" , cancellationToken ) ;
114
+ } , null ) ;
111
115
112
116
try
113
117
{
114
118
_context . Information ( "Refreshing all devices" ) ;
115
- using var enumerator = new MMDeviceEnumerator ( ) ;
119
+ var enumerator = new MMDeviceEnumerator ( ) ;
116
120
using var _ = enumerator . DisposeOnCancellation ( cancellationToken ) ;
117
121
foreach ( var endPoint in enumerator . EnumerateAudioEndPoints ( DataFlow . All , _state ) )
118
122
{
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ public Task OnFailure(JobException exception)
41
41
}
42
42
43
43
public IRetryAction FailRule { get ; } = new NoRetry ( ) ;
44
- public TimeSpan ? MaxRuntime { get ; } = TimeSpan . FromSeconds ( 5 ) ;
44
+ public TimeSpan ? MaxRuntime { get ; } = TimeSpan . FromSeconds ( 3 ) ;
45
45
public string Key { get ; }
46
46
public TimeSpan DebounceTime { get ; } = TimeSpan . FromMilliseconds ( 175 ) ;
47
47
}
You can’t perform that action at this time.
0 commit comments