Skip to content

Commit

Permalink
Attempt to ensure coordinated mining test passes with greater cache size
Browse files Browse the repository at this point in the history
  • Loading branch information
shizzard committed Feb 9, 2025
1 parent 2f1ed89 commit 65f98c8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/arweave/src/ar_chunk_cache.erl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,12 @@ add_chunk_map_fun(ChunkId, Chunk, ChunkMeta) ->
reserved_chunk_cache_bytes = ReservedChunkCacheBytes0
} = Group0) ->
case maps:find(ChunkId, ChunkCache0) of
{ok, _} -> {error, chunk_already_exists};
{ok, ?CACHE_VALUE(Chunk0, _Meta)} ->
{ok, Group0#ar_chunk_cache_group{
chunk_cache = maps:put(ChunkId, {Chunk, ChunkMeta}, ChunkCache0),
chunk_cache_size_bytes = ChunkCacheSize0 + byte_size(Chunk) - byte_size(Chunk0),
reserved_chunk_cache_bytes = max(0, ReservedChunkCacheBytes0 - byte_size(Chunk) + byte_size(Chunk0))
}};
error when ReservedChunkCacheBytes0 > 0 ->
{ok, Group0#ar_chunk_cache_group{
chunk_cache = maps:put(ChunkId, {Chunk, ChunkMeta}, ChunkCache0),
Expand Down

0 comments on commit 65f98c8

Please sign in to comment.