.affinity cooldown will now work properly on multiple shards
This commit is contained in:
@ -83,5 +83,18 @@ namespace NadekoBot.Core.Services.Impl
|
||||
_db.KeyDelete(k, CommandFlags.FireAndForget);
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryAddAffinityCooldown(ulong userId, out TimeSpan? time)
|
||||
{
|
||||
time = _db.KeyTimeToLive($"{_redisKey}_affinity_{userId}");
|
||||
if (time == null)
|
||||
{
|
||||
time = TimeSpan.FromMinutes(30);
|
||||
_db.StringSet($"{_redisKey}_affinity_{userId}", true);
|
||||
_db.KeyExpire($"{_redisKey}_affinity_{userId}", time);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user