Conversation
🦋 Changeset detectedLatest commit: ad4d073 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR 💥 An error occurred when fetching the changed packages and changesets in this PR |
| h.lastMilli = ts | ||
| } | ||
| if ts > h.lastSec { | ||
| n := max((ts-h.lastSec+999)/1000, h.minSecs) |
There was a problem hiding this comment.
comments says so, but just wanted to confirm that this is intentional, i. e. however small the first advance is and however min big min seconds, it is applied.
To take an exaggerated example, if min seconds is 100 and the first advance is 1ms, it will count 100 the first time and then let us say there are 100 more updates every second, the total would be close 200 seconds at the end, i.e 100s wall block time elapsed, but 200 secs counted. Is that understanding correct?
My mental model was "100s minimum, anything less than 100s will round up to 100s, after that, it will be elapsed time with 1 second granularity"
There was a problem hiding this comment.
h.lastSec is advanced by n * 1000 so on the first tick in your example we return 100 then for the next 100 seconds we return 0 then we begin returning rounded/elapsed seconds
There was a problem hiding this comment.
🤦 missed that detail. Thank you Paul.
No description provided.