MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / throttle

Method throttle

src/rdb.cpp:2794–2813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2792 }
2793
2794 void throttle() {
2795 if (g_pserver->m_pstorageFactory && (getMaxmemoryState(NULL,NULL,NULL,NULL) != C_OK)) {
2796 while ((cstorageWritesInFlight.load(std::memory_order_relaxed) || queueJobs.size_approx()) && (getMaxmemoryState(NULL,NULL,NULL,NULL) != C_OK)) {
2797 usleep(1);
2798 pauseExecution();
2799 ProcessWhileBlocked();
2800 resumeExecution();
2801 }
2802
2803 if ((getMaxmemoryState(NULL,NULL,NULL,NULL) != C_OK)) {
2804 for (int idb = 0; idb < cserver.dbnum; ++idb) {
2805 redisDb *db = g_pserver->db[idb];
2806 if (db->size() > 0 && db->keycacheIsEnabled()) {
2807 serverLog(LL_WARNING, "Key cache %d exceeds maxmemory during load, freeing - performance may be affected increase maxmemory if possible", idb);
2808 db->disableKeyCache();
2809 }
2810 }
2811 }
2812 }
2813 }
2814
2815 void enqueue(std::unique_ptr<rdbInsertJob> &spjob) {
2816 if (!fLaunched) {

Callers

nothing calls this directly

Calls 6

getMaxmemoryStateFunction · 0.85
serverLogFunction · 0.85
disableKeyCacheMethod · 0.80
size_approxMethod · 0.45
sizeMethod · 0.45
keycacheIsEnabledMethod · 0.45

Tested by

no test coverage detected