Fixing the redis bug, almost ready for prod

This commit is contained in:
dboerlage 2017-04-18 11:00:38 +02:00
parent 735a4a81d4
commit 5f437d74ea
No known key found for this signature in database
GPG key ID: BDA07B7D3FCF147F
6 changed files with 44 additions and 59 deletions

View file

@ -3,42 +3,6 @@ using StackExchange.Redis;
namespace Geekbot.net.Lib
{
// public class RedisClient
// {
// private static readonly Lazy<RedisClient> _instance
// = new Lazy<RedisClient>(() => new RedisClient());
// private static readonly object ThreadLock = new object();
// public static IDatabase Client;
//
// private RedisClient()
// { }
//
// public static RedisClient Instance
// {
// get
// {
// lock (ThreadLock)
// {
// if (Client == null)
// {
// try
// {
// var redis = ConnectionMultiplexer.Connect("127.0.0.1:6379");
// Client = redis.GetDatabase();
// }
// catch (Exception)
// {
// Console.WriteLine("Start Reids already you fucking faggot!");
// Environment.Exit(69);
// }
// }
// }
// return _instance.Value;
// }
// }
// }
public interface IRedisClient
{
IDatabase Client { get; set; }
@ -55,8 +19,8 @@ namespace Geekbot.net.Lib
}
catch (Exception)
{
Console.WriteLine("Start Redis already you fucking faggot!");
Environment.Exit(69);
Console.WriteLine("Start Redis pls...");
Environment.Exit(1);
}
}

View file

@ -11,10 +11,10 @@ namespace Geekbot.net.Lib
private readonly SocketMessage message;
private readonly IDatabase redis;
public StatsRecorder(SocketMessage message)
public StatsRecorder(SocketMessage message, IRedisClient redisClient)
{
this.message = message;
redis = new RedisClient().Client;
redis = redisClient.Client;
}
public async Task UpdateUserRecordAsync()