Increase connection timeout and handle lock better in poll mode.
Merge pull request #959 from arjclark/db.increase_timeout

Increase connection timeout and handle lock better in poll mode.