The game theory textbook “A Course in Microeconomic Theory” (Kreps) addresses this situation. Quoting from page 516:
We will give an exact analysis of this problem momentarily (in smaller type), but you should have no difficulty seeing the basic trade-off; too little punishment, triggered only rarely, will give your opponent the incentive to try to get away with the noncooperative strategy. You have to punish often enough and harshly enough so that your opponent is motivated to play [cooperate] instead of [defect]. But the more often/more harsh is the punishment, the less are the gains from cooperation. And even if you punish in a fashion that leads you to know that your opponent is (in her own interests) choosing [cooperate] every time (except when she is punishing), you will have to “punish” in some instances to keep your opponent honest.
The game theory textbook “A Course in Microeconomic Theory” (Kreps) addresses this situation. Quoting from page 516: