Wait for queue to fill and use scoped_session for thread safety