conditionally lock to make getting streamid faster