From 4b8ab5e474198f6ba16de6d17ff7de34ce35f723 Mon Sep 17 00:00:00 2001 From: Romazes Date: Mon, 23 Feb 2026 16:41:29 +0200 Subject: [PATCH 1/2] feat: improve logging and thread safety in data provider --- .../DataBentoHistoryProivder.cs | 2 +- .../Models/DataSetSpecifications.cs | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/QuantConnect.DataBento/DataBentoHistoryProivder.cs b/QuantConnect.DataBento/DataBentoHistoryProivder.cs index eed5697..e9c6095 100644 --- a/QuantConnect.DataBento/DataBentoHistoryProivder.cs +++ b/QuantConnect.DataBento/DataBentoHistoryProivder.cs @@ -73,7 +73,7 @@ public override void Initialize(HistoryProviderInitializeParameters parameters) { _invalidSecurityTypeWarningFired = true; Log.Trace($"{nameof(DataBentoProvider)}.{nameof(GetHistory)}:" + - $"Unsupported SecurityType '{historyRequest.Symbol.SecurityType}' for symbol '{historyRequest.Symbol}'."); + $"History request not supported for symbol '{historyRequest.Symbol}' (SecurityType: {historyRequest.Symbol.SecurityType}, Canonical: {historyRequest.Symbol.IsCanonical()})."); } return null; } diff --git a/QuantConnect.DataBento/Models/DataSetSpecifications.cs b/QuantConnect.DataBento/Models/DataSetSpecifications.cs index 1782043..a99c92d 100644 --- a/QuantConnect.DataBento/Models/DataSetSpecifications.cs +++ b/QuantConnect.DataBento/Models/DataSetSpecifications.cs @@ -56,6 +56,7 @@ public static class PredefinedDataSets /// public class DataSetSpecifications { + private readonly Lock _lock = new(); /// /// Internal flag to ensure the delay warning message is only generated once. /// @@ -117,13 +118,21 @@ public bool TryGetDelayWarningMessage(out string? message) { return false; } - message = $"Dataset [{DataSetID}] historical data information:\n" + + lock (_lock) + { + if (_delayWarningFired) + { + return false; + } + + message = $"Dataset [{DataSetID}] historical data information:\n" + $"- Users with a live license: delayed by approximately {HistoricalDelayWithLicense}." + $"For access to more recent data, use the intraday replay feature of the live data client.\n" + $"- Users without a license: delayed by {HistoricalDelayWithoutLicense}.\n" + $"- More information: {Link} (go to the 'Specifications' tab)"; - _delayWarningFired = true; - return true; + _delayWarningFired = true; + return true; + } } } From 0769439af853828f9b00b0776516f553759692d6 Mon Sep 17 00:00:00 2001 From: Romazes Date: Mon, 23 Feb 2026 16:57:47 +0200 Subject: [PATCH 2/2] feat: make _lock static in DataSetSpecifications --- QuantConnect.DataBento/Models/DataSetSpecifications.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QuantConnect.DataBento/Models/DataSetSpecifications.cs b/QuantConnect.DataBento/Models/DataSetSpecifications.cs index a99c92d..e0d0866 100644 --- a/QuantConnect.DataBento/Models/DataSetSpecifications.cs +++ b/QuantConnect.DataBento/Models/DataSetSpecifications.cs @@ -56,7 +56,7 @@ public static class PredefinedDataSets /// public class DataSetSpecifications { - private readonly Lock _lock = new(); + private static readonly Lock _lock = new(); /// /// Internal flag to ensure the delay warning message is only generated once. ///