limit the concurrent rest calls and fix deadlock when concurrent=1