Skip to content

Commit 09ba90a

Browse files
authored
Add field to extractor to set the scheduler timeout (#543)
There's currently no way to pass this to the base extractor, so the timeout feature isn't very helpful...
1 parent 458c8d5 commit 09ba90a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ExtractorUtils/BaseExtractor.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ public abstract class BaseExtractor<TConfig> : IDisposable, IAsyncDisposable
7777
/// </summary>
7878
protected RemoteConfigManager<TConfig>? ConfigManager { get; }
7979

80+
/// <summary>
81+
/// Timeout in milliseconds for the scheduler to shut down when closing.
82+
/// Defaults to 0, which waits forever.
83+
/// </summary>
84+
protected int SchedulerExitTimeoutMs { get; set; }
85+
8086
private readonly ILogger<BaseExtractor<TConfig>> _logger;
8187

8288
/// <summary>
@@ -383,7 +389,7 @@ protected virtual void Dispose(bool disposing)
383389
try
384390
{
385391
// Cannot be allowed to fail here
386-
Scheduler.ExitAllAndWait().Wait();
392+
Scheduler.ExitAllAndWait(SchedulerExitTimeoutMs).Wait();
387393
}
388394
catch { }
389395
Scheduler.Dispose();
@@ -417,7 +423,7 @@ protected virtual async ValueTask DisposeAsyncCore()
417423
{
418424
try
419425
{
420-
await Scheduler.ExitAllAndWait().ConfigureAwait(false);
426+
await Scheduler.ExitAllAndWait(SchedulerExitTimeoutMs).ConfigureAwait(false);
421427
}
422428
catch (Exception ex)
423429
{

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.33.0
1+
1.34.0

0 commit comments

Comments
 (0)