something like this might be clearer:

`if(this.attempts_before_flush && this.attempts > this.attempts_before_flush) {`

this.attempts_before_flush should be undefined or set to -1 when the option is not set.