improving hanging test and tidy up on the Queue API to couple with flush timeout externally
Merge pull request #893 from clebertsuconic/master

changing timeout API and improving tests