Add tracking for analyzed traders and add crawling configuration to appsettings.json
This commit is contained in:
@@ -5,6 +5,7 @@ using Predictalytics.Infrastructure.Logging;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Predictalytics.Worker.Services;
|
||||
|
||||
@@ -96,6 +97,15 @@ public class TradeHistoryWorker : BackgroundService
|
||||
var provider = providers.FirstOrDefault(p => p.Platform == trader.Platform && p.IsImplemented);
|
||||
if (provider == null) return;
|
||||
|
||||
var config = scope.ServiceProvider.GetRequiredService<Microsoft.Extensions.Configuration.IConfiguration>();
|
||||
bool isEnabled = config.GetValue<bool>($"PlatformSettings:{provider.PlatformName}:EnableCrawling", provider.Platform == PlatformType.Polymarket);
|
||||
if (!isEnabled)
|
||||
{
|
||||
trader.LastPolledAt = DateTime.UtcNow;
|
||||
await traderRepo.UpdateAsync(trader, ct);
|
||||
return;
|
||||
}
|
||||
|
||||
using var platformCtx = PlatformLogContext.Push(provider.PlatformName);
|
||||
await rateLimiter.WaitAsync(trader.Platform, ct);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user