Files
torrentio/src/torrent-consumer/Features/TorrentIngestion/PerformIngestionConsumer.cs
iPromKnight 66609c2a46 trigram performance increased and housekeeping (#184)
* add new indexes, and change year column to int

* Change gist to gin, and change year to int

* Producer changes for new gin query

* Fully map the rtn response using json dump from Pydantic

Also updates Rtn to 0.1.9

* Add housekeeping script to reconcile imdb ids.

* Join Torrent onto the ingested torrent table

Ensure that a torrent can always find the details of where it came from, and how it was parsed.

* Version bump for release

* missing quote on table name
2024-03-29 19:01:48 +00:00

27 lines
1.1 KiB
C#

namespace TorrentConsumer.Features.TorrentIngestion;
public class PerformIngestionConsumer(IDataStorage dataStorage, ILogger<PerformIngestionConsumer> logger, IBus messageBus) : IConsumer<PerformIngestionActions>
{
public async Task Consume(ConsumeContext<PerformIngestionActions> context)
{
var request = context.Message;
logger.LogInformation("Performing ingestion actions for infoHash {InfoHash} in Saga {SagaId}", request.IngestedTorrent.InfoHash, request.CorrelationId);
var torrent = new Torrent
{
InfoHash = request.IngestedTorrent.InfoHash.ToLowerInvariant(),
IngestedTorrentId = request.IngestedTorrent.Id,
Provider = request.IngestedTorrent.Source,
Title = request.IngestedTorrent.Name,
Type = request.IngestedTorrent.Category,
Seeders = request.IngestedTorrent.Seeders,
Reviewed = false,
Opened = false,
};
await dataStorage.InsertTorrent(torrent);
await messageBus.Publish(new IngestionCompleted(request.CorrelationId, torrent));
}
}