First select <number-of-database-connections> rows, then acquire up to one lock.

This seems to solve a concurrency issue where every so often the database
will acquire a lock on thousands of row because the limit is applied only
afterwards.
Fixed issue where the same item could be worked twice.
Added test requires.
Simplify candidates selection.
Updated changes file.
Rewrote the dynamic timeout support.

- Moved the next timeout prediction into the SQL result.
- Grouped all timeout related logic inside `Queue.get()` method.
- Last timeout is successfully cached for optimization purposes.
- Removed the `NotYet` exception.
- This should fix the leaking database connections issue.
Pass the connection directly to select.
Make sure the timeout is reset back if no estimation returned.
A tentative to make timing tests cleaner.
Added a test helper to test execution time.

Updated relevant tests to use it.
Add mean avg and stdev on benchmark
Refactor tests
Merge pull request #1 from malthe/fix-contention-and-locks-issue

Add mean avg and stdev on benchmark
Merge pull request #2 from stas/fix-contention-and-locks-issue

Fix contention and locks issue