Skip to content

Commit

Permalink
fix(cache): add maintain is_empty status
Browse files Browse the repository at this point in the history
  • Loading branch information
HarukiMoriarty committed May 20, 2024
1 parent ee75e77 commit bd9ccf4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions calmapf/src/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ bool Cache::update_cargo_from_cache(Vertex* cargo, Vertex* cache_node) {
// Simply release lock
cache_console->debug("Agents gets {} from cache {}", *cargo, *cache_node);
bit_cache_get_lock[cache_node->group][cache_index] -= 1;

// If the cache block has no more cargoes and is not locked, set it as empty
if (bit_cache_get_lock[cache_node->group][cache_index] == 0 && node_cargo_num[cache_node->group][cache_index] == 0)
{
is_empty[cache_node->group][cache_index] = true;
}

return true;
}

0 comments on commit bd9ccf4

Please sign in to comment.