mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
Introduce max batch size, and configurable publish window
Still need to implement queue size limit Also fixes env var consistency between addon and consumer
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
namespace Scraper.Services;
|
||||
namespace Producer.Services;
|
||||
|
||||
public class DapperDataStorage(ScrapeConfiguration configuration, ILogger<DapperDataStorage> logger) : IDataStorage
|
||||
public class DapperDataStorage(ScrapeConfiguration configuration, RabbitMqConfiguration rabbitConfig, ILogger<DapperDataStorage> logger) : IDataStorage
|
||||
{
|
||||
private const string InsertTorrentSql =
|
||||
"""
|
||||
@@ -65,7 +65,7 @@ public class DapperDataStorage(ScrapeConfiguration configuration, ILogger<Dapper
|
||||
await using var connection = new NpgsqlConnection(configuration.StorageConnectionString);
|
||||
await connection.OpenAsync(cancellationToken);
|
||||
var torrents = await connection.QueryAsync<Torrent>(GetMovieAndSeriesTorrentsNotProcessedSql);
|
||||
return torrents.ToList();
|
||||
return torrents.Take(rabbitConfig.MaxPublishBatchSize).ToList();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Scraper.Services;
|
||||
namespace Producer.Services;
|
||||
|
||||
public class IpService(ILogger<IpService> logger, IHttpClientFactory httpClientFactory) : IIpService
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Scraper.Services;
|
||||
namespace Producer.Services;
|
||||
|
||||
public class TorrentPublisher(ISendEndpointProvider sendEndpointProvider, RabbitMqConfiguration configuration) : IMessagePublisher
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user