From 765ffea018e6f3e65352287fe36d757e8c064676 Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 1 Mar 2020 19:17:58 -0500 Subject: [PATCH 1/3] Rename cron command to KEYDB.CRON and add help Former-commit-id: 3eb847e28f6df45528dcebc6761290ff60248e78 --- src/help.h | 8 +++++++- src/server.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/help.h b/src/help.h index 34f4e77c7..d3870d490 100644 --- a/src/help.h +++ b/src/help.h @@ -1168,7 +1168,13 @@ struct commandHelp { "destination numkeys key [key ...] [WEIGHTS weight] [AGGREGATE SUM|MIN|MAX]", "Add multiple sorted sets and store the resulting sorted set in a new key", 4, - "2.0.0" } + "2.0.0" }, + { "KEYDB.CRON", + "name [single/repeat] [optional: start] delay script numkeys [key N] [arg N]", + "Run a specified script after start + delay, optionally repeating every delay interval. The job may be cancelled by deleting the key associated with the job (name parameter)", + 10, + "6.5.2" + } }; #endif diff --git a/src/server.cpp b/src/server.cpp index 837b1c38e..311f2bffa 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1026,7 +1026,7 @@ struct redisCommand redisCommandTable[] = { "read-only fast noprop", 0,NULL,0,0,0,0,0,0}, - {"cron",cronCommand,-5, + {"keydb.cron",cronCommand,-5, "write use-memory", 0,NULL,1,1,1,0,0,0}, }; From de3d796eb765e038e9f330ef2797f29a8aa585c8 Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 1 Mar 2020 21:42:01 -0500 Subject: [PATCH 2/3] Update tests to reflect new CRON name (keydb.cron) Former-commit-id: 83f585e30ab9d37408c79b74e2536664325a051f --- tests/unit/cron.tcl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/unit/cron.tcl b/tests/unit/cron.tcl index 554df9328..dddf78255 100644 --- a/tests/unit/cron.tcl +++ b/tests/unit/cron.tcl @@ -1,47 +1,47 @@ start_server {tags {"CRON"}} { - test {cron singleshot past tense} { + test {keydb.cron singleshot past tense} { r flushall - r cron testjob single 0 1 {redis.call("incr", "testkey")} 1 testkey + r keydb.cron testjob single 0 1 {redis.call("incr", "testkey")} 1 testkey after 300 assert_equal 1 [r get testkey] assert_equal 0 [r exists testjob] } - test {cron repeat past tense next exec is in the future} { + test {keydb.cron repeat past tense next exec is in the future} { r flushall - r cron testjob repeat 0 1000000 {redis.call("incr", "testkey")} 1 testkey + r keydb.cron testjob repeat 0 1000000 {redis.call("incr", "testkey")} 1 testkey after 300 assert_equal 1 [r get testkey] assert_equal 1 [r exists testjob] r del testjob } - test {cron repeat works} { + test {keydb.cron repeat works} { r flushall - r cron testjob repeat 0 600 {redis.call("incr","testkey")} + r keydb.cron testjob repeat 0 600 {redis.call("incr","testkey")} after 1000 assert_equal 2 [r get testkey] } - test {cron overwrite works} { + test {keydb.cron overwrite works} { r flushall - r cron testjob single 500 {redis.call("set","testkey","a")} 1 testkey - r cron testjob single 500 {redis.call("set","anotherkey","b")} 1 anotherkey + r keydb.cron testjob single 500 {redis.call("set","testkey","a")} 1 testkey + r keydb.cron testjob single 500 {redis.call("set","anotherkey","b")} 1 anotherkey after 1000 assert_equal 0 [r exists testkey] assert_equal b [r get anotherkey] } - test {cron delete key stops job} { + test {keydb.cron delete key stops job} { r flushall - r cron testjob single 500 {redis.call("set","testkey","a")} + r keydb.cron testjob single 500 {redis.call("set","testkey","a")} r del testjob after 1000 assert_equal 0 [r exists testkey] } - test {cron zero interval rejected} { - catch {r cron testjob single 0 0 {redis.call("incr","testkey")} 1 testkey} e + test {keydb.cron zero interval rejected} { + catch {r keydb.cron testjob single 0 0 {redis.call("incr","testkey")} 1 testkey} e assert_match {ERR*} $e } } From 87b36b00dfbe9c11f3f386dd39e2152e4d8b0db4 Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 1 Mar 2020 22:16:25 -0500 Subject: [PATCH 3/3] Add option to build pro without license checks Former-commit-id: 0713518d2f34559a06db31a9023228b91ce60af3 --- src/Makefile | 5 +++++ src/server.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/Makefile b/src/Makefile index 45c70f6d6..cef895987 100644 --- a/src/Makefile +++ b/src/Makefile @@ -108,6 +108,11 @@ ifeq ($(USE_JEMALLOC),no) MALLOC=libc endif + +ifeq ($(NO_LICENSE_CHECK),yes) + CXXFLAGS+=-DNO_LICENSE_CHECK=1 +endif + # Override default settings if possible -include .make-settings diff --git a/src/server.cpp b/src/server.cpp index 53a16e54d..82f334fda 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1103,6 +1103,7 @@ void serverLog(int level, const char *fmt, ...) { static void checkTrialTimeout() { +#ifndef NO_LICENSE_CHECK if (cserver.license_key != nullptr && FValidKey(cserver.license_key, strlen(cserver.license_key))) return; time_t curtime = time(NULL); @@ -1118,6 +1119,7 @@ static void checkTrialTimeout() { serverLog(LL_WARNING, "Trial timeout in %ld:%02ld minutes", remaining/60, remaining % 60); } +#endif } /* Log a fixed message without printf-alike capabilities, in a way that is