added event for invalid cache shrink

This commit is contained in:
Scott E. Graves 2024-12-21 06:26:50 -06:00
parent 9bb91682da
commit 636f8ec0fb

View File

@ -29,6 +29,11 @@
namespace repertory {
// clang-format off
E_SIMPLE2(invalid_cache_size, warn, true,
std::uint64_t, cache_size, sz, E_FROM_UINT64,
std::uint64_t, reduce, rd, E_FROM_UINT64
);
E_SIMPLE2(max_cache_size_reached, warn, true,
std::uint64_t, cache_size, sz, E_FROM_UINT64,
std::uint64_t, max_cache_size, max, E_FROM_UINT64
@ -93,7 +98,7 @@ auto cache_size_mgr::shrink(std::uint64_t size) -> api_error {
if (cache_size_ >= size) {
cache_size_ -= size;
} else {
// TODO raise warning
event_system::instance().raise<max_cache_size_reached>(cache_size_, size);
cache_size_ = 0U;
}