Closed GoogleCodeExporter closed 8 years ago
Good spot; I think I was at one point using BeginConnect, which annoyingly does
the DNS resolution on the caller's thread, so it was impossible to guarantee
any timeliness when using that - but it looks like this is fixed in
ConnectAsync.
Minor note: these were very intentional:
- var state = (Tuple<RedisConnectionBase,
TaskCompletionSource<bool>>)task.AsyncState;
+ var state = task.AsyncState as Tuple<RedisConnectionBase,
TaskCompletionSource<bool>>;
If I have the type of state mismatched, I absolutely **don't** want that
becoming a null-ref error: I want a very clear and obvious
invalid-cast-exception
Original comment by marc.gravell
on 18 Apr 2013 at 7:18
For info, if you are working on a system with lots of Tasks, you might also
want to play with the CompletionMode on the connection; there are 3 options:
- always async (Concurrent); callbacks are performed as tasks (except for some
inbuilt commands)
- always sync (PreserveOrder); callbacks are performed by the reader thread
- mixed (ConcurrentIfContinuation); it attempts to see whether a task has a
continuation; if it does, it performs it async; if it does not, it performs it
sync
Original comment by marc.gravell
on 18 Apr 2013 at 7:30
Original issue reported on code.google.com by
tcae...@gmail.com
on 18 Apr 2013 at 5:48