Permalink
Browse files

Fixing global read operation

  • Loading branch information...
1 parent ea49fee commit 13944b68ab5820712d2bd0df9d42b0dfedac4b6d @abdullin abdullin committed Feb 19, 2013
Showing with 11 additions and 7 deletions.
  1. +4 −0 Source/Btw.Redis.Tests/TestRedisManual.cs
  2. +7 −7 Source/Btw.Redis/RedisAppendOnlyStore.cs
@@ -30,6 +30,10 @@ public void ReadAll()
{
var dataWithVersions = store.ReadRecords("test", 0, int.MaxValue).ToArray();
Console.WriteLine(dataWithVersions.Length);
+
+ var records = store.ReadRecords(0, int.MaxValue).ToArray();
+ Console.WriteLine(records.Length);
+
}
}
}
@@ -105,26 +105,26 @@ public IEnumerable<StoreData> ReadRecords(long afterVersion, int maxCount)
var end = maxCount == Int32.MaxValue ? maxCount : maxCount + afterVersion - 1;
var items = _client.Eval(@"
-local storeVersion = redis.call('HLEN', 'STORE')
+local store = redis.call('HLEN', 'STORE')
-local start = ARGV[1]
-local end = ARGV[2]
+local start = tonumber(ARGV[1])
+local finish = tonumber(ARGV[2])
if start > store then
start = store
end
-if end > store then
- end = store
+if finish > store then
+ finish = store
end
local events = {}
-for i = start, end do
+for i = start, finish do
events[i] = redis.call('HGET','STORE',i)
end
-return events", 1, Encoding.UTF8.GetBytes(start.ToString()), Encoding.UTF8.GetBytes(end.ToString()));
+return events", 0, Encoding.UTF8.GetBytes(start.ToString()), Encoding.UTF8.GetBytes(end.ToString()));
for (int i = 0; i < items.Length; i++)
{

0 comments on commit 13944b6

Please sign in to comment.