diff --git a/src/config.cpp b/src/config.cpp index ca9181788..9385b440c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -2535,6 +2535,7 @@ standardConfig configs[] = { createBoolConfig("use-fork", NULL, IMMUTABLE_CONFIG, cserver.fForkBgSave, 0, NULL, NULL), createBoolConfig("allow-write-during-load", NULL, MODIFIABLE_CONFIG, g_pserver->fWriteDuringActiveLoad, 0, NULL, NULL), createBoolConfig("io-threads-do-reads", NULL, IMMUTABLE_CONFIG, fDummy, 0, NULL, NULL), + createBoolConfig("time-thread-priority", NULL, IMMUTABLE_CONFIG, cserver.time_thread_priority, 0, NULL, NULL), /* String Configs */ createStringConfig("aclfile", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, g_pserver->acl_filename, "", NULL, NULL), diff --git a/src/server.cpp b/src/server.cpp index e4eba3453..f4a068892 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -6443,9 +6443,11 @@ int main(int argc, char **argv) { serverAssert(cserver.cthreads > 0 && cserver.cthreads <= MAX_EVENT_LOOPS); pthread_create(&cserver.time_thread_id, nullptr, timeThreadMain, nullptr); +if (cserver.time_thread_priority) { struct sched_param time_thread_priority; time_thread_priority.sched_priority = sched_get_priority_max(SCHED_FIFO); pthread_setschedparam(cserver.time_thread_id, SCHED_FIFO, &time_thread_priority); +} pthread_attr_t tattr; pthread_attr_init(&tattr); diff --git a/src/server.h b/src/server.h index 1fbb77c60..cb93a2047 100644 --- a/src/server.h +++ b/src/server.h @@ -2000,6 +2000,7 @@ struct redisServerConst { int storage_memory_model = STORAGE_WRITETHROUGH; char *storage_conf = nullptr; int fForkBgSave = false; + int time_thread_priority = false; }; struct redisServer { diff --git a/tests/unit/introspection.tcl b/tests/unit/introspection.tcl index 54d9dbbcd..30376ba45 100644 --- a/tests/unit/introspection.tcl +++ b/tests/unit/introspection.tcl @@ -90,6 +90,7 @@ start_server {tags {"introspection"}} { server_cpulist bio_cpulist aof_rewrite_cpulist + time-thread-priority bgsave_cpulist storage-cache-mode storage-provider-options