added mirror spawn retry logic

not sure about using Velocity.spawnAttempts as opposed to file-scoped var.  Opinions?
Can you please separate the decrementation from the comparison. I think this line is hard to understand. And please add curly braces. You can use the .jshintrc config from the repository to check the code style with JSHint ;-)