<commit_before>﻿using System;
using System.Threading.Tasks;
using Nimbus.Infrastructure.MessageSendersAndReceivers;
using StackExchange.Redis;

namespace Nimbus.Transports.Redis.MessageSendersAndReceivers
{
    internal class RedisMessageSender : INimbusMessageSender
    {
        private readonly string _redisKey;
        private readonly ISerializer _serializer;
        private readonly Func<IDatabase> _databaseFunc;

        public RedisMessageSender(string redisKey, ISerializer serializer, Func<IDatabase> databaseFunc)
        {
            _redisKey = redisKey;
            _serializer = serializer;
            _databaseFunc = databaseFunc;
        }

        public async Task Send(NimbusMessage message)
        {
            var serialized = _serializer.Serialize(message);
            var database = _databaseFunc();
            await database.ListRightPushAsync(_redisKey, serialized);
            await database.PublishAsync(_redisKey, string.Empty);
        }
    }
}<commit_msg>Yet more debug logging<commit_after>﻿using System;
using System.Threading.Tasks;
using Nimbus.Infrastructure.MessageSendersAndReceivers;
using StackExchange.Redis;

namespace Nimbus.Transports.Redis.MessageSendersAndReceivers
{
    internal class RedisMessageSender : INimbusMessageSender
    {
        private readonly string _redisKey;
        private readonly ISerializer _serializer;
        private readonly Func<IDatabase> _databaseFunc;
        private readonly ILogger _logger;

        public RedisMessageSender(string redisKey, ISerializer serializer, Func<IDatabase> databaseFunc, ILogger logger)
        {
            _redisKey = redisKey;
            _serializer = serializer;
            _databaseFunc = databaseFunc;
            _logger = logger;
        }

        public async Task Send(NimbusMessage message)
        {
            var serialized = _serializer.Serialize(message);
            var database = _databaseFunc();

            var pushResult = await database.ListRightPushAsync(_redisKey, serialized);
            _logger.Debug($"Redis {nameof(database.ListRightPushAsync)} returned {{RedisReturnCode}}", pushResult);

            var publishResult = await database.PublishAsync(_redisKey, string.Empty);
            _logger.Debug($"Redis {nameof(database.PublishAsync)} returned {{RedisReturnCode}}", publishResult);
        }
    }
}
{'fraction_non_alphanumeric': 0.07115628970775095, 'fraction_numerical': 0.0, 'mean_word_length': 3.0514579759862777, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5940286', 'n_tokens_mistral': 626, 'n_tokens_neox': 627, 'n_words': 137}