Commit a010a1fe authored by Nick Craver's avatar Nick Craver

Cursors: better error message

parent 9a2425f7
...@@ -178,7 +178,7 @@ protected Task<ScanResult> GetNextPageAsync(IScanningCursor obj, long cursor) ...@@ -178,7 +178,7 @@ protected Task<ScanResult> GetNextPageAsync(IScanningCursor obj, long cursor)
return redis.ExecuteAsync(CreateMessage(cursor), Processor, server); return redis.ExecuteAsync(CreateMessage(cursor), Processor, server);
} }
protected ScanResult Wait(Task<ScanResult> pending) => redis.Wait(pending); protected bool TryWait(Task<ScanResult> pending) => redis.TryWait(pending);
private class CursorEnumerator : IEnumerator<T>, IScanningCursor private class CursorEnumerator : IEnumerator<T>, IScanningCursor
{ {
...@@ -254,7 +254,15 @@ public bool MoveNext() ...@@ -254,7 +254,15 @@ public bool MoveNext()
// do we have an outstanding operation? wait for the background task to finish // do we have an outstanding operation? wait for the background task to finish
while (pending != null) while (pending != null)
{ {
ProcessReply(parent.Wait(pending)); if (parent.TryWait(pending))
{
ProcessReply(pending.Result);
}
else
{
throw ExceptionFactory.Timeout(parent.redis.multiplexer.IncludeDetailInExceptions, "Timeout waiting for scan cursor to complete", null, parent.server);
}
if (SimpleNext()) return true; if (SimpleNext()) return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment