Skip to content

Commit 13be0e8

Browse files
feat: cleaned the pr
1 parent 134898b commit 13be0e8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

app/services/billing/rate_cards/schedule.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,15 @@ def next_billing_at(timestamp)
7474

7575
attr_reader :anchor_date, :phases, :rates, :terms, :realign_billing_anchor, :timezone, :starts_at, :ends_at, :timing
7676

77+
# Both consumers of this engine read the walk twice — /cycles serializes the windows
78+
# and reports the next billing instant, /bill writes the rows and advances the clock.
79+
# The previous engine memoized its own walk for the same reason.
7780
def walk(timestamp)
81+
@walks ||= {}
82+
@walks[timestamp] ||= walk_from(timestamp)
83+
end
84+
85+
def walk_from(timestamp)
7886
cursor = starts_at
7987
index = 0
8088
due = []

0 commit comments

Comments
 (0)