MCPcopy Create free account
hub / github.com/catboost/catboost / PurgeCache

Method PurgeCache

library/cpp/neh/http2.cpp:1059–1076  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1057 }
1058
1059 void PurgeCache() noexcept {
1060 //try remove at least ExceedSoftLimit() oldest connections from cache
1061 //вычисляем долю кеша, которую нужно почистить (в 256 долях) (но не менее 1/32 кеша)
1062 size_t frac256 = Min(size_t(Max(size_t(256U / 32U), (ExceedSoftLimit() << 8) / (Cache_.Size() + 1))), (size_t)256U);
1063
1064 size_t processed = 0;
1065 size_t maxConnId = AtomicGet(MaxConnId_);
1066 for (size_t i = 0; i <= maxConnId && !Shutdown_; ++i) {
1067 processed += Cache_.Purge(i, frac256);
1068 if (processed > 32) {
1069#ifdef DEBUG_STAT
1070 TDebugStat::ConnPurgedInCache += processed;
1071#endif
1072 processed = 0;
1073 Sleep(TDuration::MilliSeconds(10)); //prevent big spike cpu/system usage
1074 }
1075 }
1076 }
1077
1078 TFdLimits Limits;
1079 TExecutorsPool EP_;

Callers

nothing calls this directly

Calls 7

SleepFunction · 0.85
MilliSecondsFunction · 0.85
MinFunction · 0.50
MaxFunction · 0.50
AtomicGetFunction · 0.50
SizeMethod · 0.45
PurgeMethod · 0.45

Tested by

no test coverage detected