You make a good point. My guess is that the claimAll() function will not claim from the same window twice. For example, suppose period #10 has just ended. If this is the first time I'm running claimAll() it will run in a loop for every period between period #10 to period #0. Then 3 days later when period #13 has ended, claimAll() will run in a loop between period #13 to period #11. It will not bother running through periods #0 to #10 again.
At least this is my guess anyway, someone else may be able to confirm
Yes, that is exactly how it works.
claimAll
will only attempt to claim unclaimed periodspseudocode: periods[n] === false