Skip to content

Commit 72cb9a1

Browse files
committed
Made maxQueueSize configurable
1 parent f4f8f94 commit 72cb9a1

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Apps/QueryLogsDuckDBApp/App.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ public sealed class App : IDnsApplication, IDnsQueryLogger, IDnsQueryLogs
3636
{
3737
#region variables
3838

39-
private const int CHANNEL_CAPACITY = 20_000;
4039
private const int MAX_BATCH_SIZE = 1000;
4140
private Channel<LogEntry> _channel;
4241
private DuckDBConnection _conn;
4342
private Task _consumerTask;
4443
private bool _disposed;
4544
private IDnsServer _dnsServer;
4645
private bool _enableLogging;
46+
private int _maxQueueSize;
4747
#endregion variables
4848

4949
#region IDisposable
@@ -216,11 +216,13 @@ public async Task InitializeAsync(IDnsServer dnsServer, string config)
216216

217217
string dbPath = cfg.GetPropertyValue("dbPath", "querylogs.db");
218218

219+
_maxQueueSize = cfg.GetPropertyValue("maxQueueSize", 20000);
220+
219221
if (!System.IO.Path.IsPathRooted(dbPath))
220222
dbPath = System.IO.Path.Combine(dnsServer.ApplicationFolder, dbPath);
221223

222224
_channel = Channel.CreateBounded<LogEntry>(
223-
new BoundedChannelOptions(CHANNEL_CAPACITY)
225+
new BoundedChannelOptions(_maxQueueSize)
224226
{
225227
SingleReader = true,
226228
SingleWriter = true,
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"enableLogging": true,
3-
"dbPath": "querylogs.db"
3+
"dbPath": "querylogs.db",
4+
"maxQueueSize": 20000
45
}

0 commit comments

Comments
 (0)