Skip to content

Commit 260f47b

Browse files
committed
Do not create threadpools if we won't need them
1 parent c08683e commit 260f47b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/server.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4159,10 +4159,15 @@ void InitServerLast() {
41594159

41604160
g_pserver->asyncworkqueue = new (MALLOC_LOCAL) AsyncWorkQueue(cserver.cthreads);
41614161

4162-
g_pserver->asyncreadworkqueue = new (MALLOC_LOCAL) AsyncWorkQueue(cserver.cthreads*10);
4162+
if (g_pserver->m_pstorageFactory != nullptr) {
4163+
g_pserver->asyncreadworkqueue = new (MALLOC_LOCAL) AsyncWorkQueue(cserver.cthreads);
41634164

4164-
//Process one write/commit at a time to ensure consistency
4165-
g_pserver->asyncwriteworkqueue = new (MALLOC_LOCAL) AsyncWorkQueue(1);
4165+
//Process one write/commit at a time to ensure consistency
4166+
g_pserver->asyncwriteworkqueue = new (MALLOC_LOCAL) AsyncWorkQueue(1);
4167+
} else {
4168+
g_pserver->asyncreadworkqueue = nullptr;
4169+
g_pserver->asyncwriteworkqueue = nullptr;
4170+
}
41664171

41674172
// Allocate the repl backlog
41684173

0 commit comments

Comments
 (0)