Commit Graph

7 Commits

Author SHA1 Message Date
4dade9e0e6
Improve test coverage 2017-10-07 18:13:02 +02:00
ff55e2f055
Get rid of wait groups 2017-10-07 17:48:36 +02:00
9476a00648 Simplify main fetching/sorting logic
Reduced the amount of go-routines. Now sorting
is done in the same go-routine as URLs are fetched.

Then these sorted lists are merged one by one
in a loop as they arrive.

This greatly reduces complexity.
2017-09-11 16:13:38 +02:00
ebbcd71b3d Optimize merging/sorting
Previously we sorted a list e.g. [3,2,1]
that we already got, then fetched another
list e.g. [6,7,8,2]. Instead of just
sorting the new list and manually merging it
we would sort the appended lists:
[1,2,3,  6,7,8,2]

Despite mergesort, this is now optimized in
a two-step process:
* ONLY sort the new list
* call a Merge function on both lists, that assumes
  sorted and deduplicated lists

This should be faster.
2017-09-11 16:13:31 +02:00
17aa010ebf Use context.Context for cancellation 2017-09-11 16:13:18 +02:00
771f7c6892 Meet the 500ms timeout
* First, lower the MaxResponseTime which is used
  in the Handler to cancel the running goroutines
  and finalize the result. Since we want to stay below 500ms
  we cannot pick 500ms, because the finalization steps
  take some time too.
* Second, set WriteTimeout to 500ms in order to make sure
  the handler never exceeds that timeframe.
2017-09-11 12:12:23 +02:00
c76b5266e2 Initial commit 2017-09-11 12:08:43 +02:00