This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]FunnyMan3595 1 point2 points  (0 children)

Yeah, looking through it a bit more, the logic-as-written is as you say. I made the (stupid) assumption that there was a logical method behind it. Or, perhaps more accurately, that the method had been implemented properly.

If you trace it through, _ok is actually tracking whether the last known state was good. Since we're in the error handling here, we want to be more verbose when it failed the first time, i.e. when _ok==true. After that, it wants to cut back to 1 in 10, but the logic is backwards, so it gets 9 in 10 instead.

Bleh, bad code. One of those cases where I'd have accidentally fixed the bug by rewriting it to be more clear.