Ayende @ Rahien

Hi!
My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

, @ Q c

Posts: 6,128 | Comments: 45,550

filter by tags archive

Didja know, RavenDB include a proxy server

time to read 1 min | 124 words

This is one of those things that I had to read several times to realize what was actually going on.

The code for that is here: https://github.com/ayende/ravendb/blob/c0c9ccf98011fb64b5eb5406a900ec1338ea78e4/Raven.Tests/Issues/RavenDB_1603.cs#L32

And it appears that along with every else, RavenDB also include a proxy server.

Now, to be fair, this is required for our tests, to see what happens when we have a forced disconnect / timeout at the network level, so it make sense. And the whole thing is under 100 lines of code.

This sort of thing explains why we really need to do a whole bunch of work on our tests. We want to get to a 500 – 1000 tests (currently we have close to 3,200) that run in under 5 minutes.


Comments

Rafal

Nice proxy, and some clever use of async I yet have to get used to. But for a beginning, what's the difference between

var read = await incomingStream.ReadAsync(buffer, 0, 4096, token);

and

var read = incomingStream.Read(buffer, 0, 4096)

is the first one any better?

Andy Pook

It looks like there are a couple of "bugs". Two of the while(true) loops look like will never exit (except on exception). In Forward it should probably use "!cancellationTokenSource.IsCancellationRequested" In the writeTask it should probably "break" when "read == 0" as the readTask does. An "extract method" refactoring would help.

Without these I think there's a task leak. Though as this is "just test code" it's safe enough :)

Ayende Rahien

Rafal, The first one is better because it will yield the thread for the duration of the actual IO, leaving it free to do other work.

Comment preview

Comments have been closed on this topic.

FUTURE POSTS

  1. The worker pattern - about one day from now

There are posts all the way to May 30, 2016

RECENT SERIES

  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats