Skip to content
This repository was archived by the owner on Mar 17, 2023. It is now read-only.

Commit b520ded

Browse files
committed
Remove memoization that does not respect argument
Should be fine since we in practive only invoke #chunk once.
1 parent b8d1329 commit b520ded

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

lib/tina/restore_plan.rb

+9-11
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,17 @@ def size
4545
end
4646

4747
def chunk(max_chunk_size)
48-
@chunks ||= begin
49-
sum = 0
50-
index = 0
51-
chunks = @objects.chunk do |object|
52-
sum += object.size
53-
if sum > max_chunk_size
54-
sum = object.size
55-
index += 1
56-
end
57-
index
48+
sum = 0
49+
index = 0
50+
chunks = @objects.chunk do |object|
51+
sum += object.size
52+
if sum > max_chunk_size
53+
sum = object.size
54+
index += 1
5855
end
59-
chunks.map(&:last)
56+
index
6057
end
58+
chunks.map(&:last)
6159
end
6260
end
6361
end

0 commit comments

Comments
 (0)