added a sleep command to fdbcli

This commit is contained in:
Evan Tschannen 2019-08-16 18:13:35 -07:00
parent b744c4b06e
commit d8ab48ce7f
1 changed files with 21 additions and 0 deletions

View File

@ -498,6 +498,10 @@ void initHelp() {
helpMap["quit"] = CommandHelp();
helpMap["waitconnected"] = CommandHelp();
helpMap["waitopen"] = CommandHelp();
helpMap["sleep"] = CommandHelp(
"sleep <SECONDS>",
"sleep for a period of time",
"");
helpMap["get"] = CommandHelp(
"get <KEY>",
"fetch the value for a given key",
@ -2736,6 +2740,23 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
continue;
}
if( tokencmp(tokens[0], "sleep")) {
if(tokens.size() != 2) {
printUsage(tokens[0]);
is_error = true;
} else {
double v;
int n=0;
if (sscanf(tokens[1].toString().c_str(), "%lf%n", &v, &n) != 1 || n != tokens[1].size()) {
printUsage(tokens[0]);
is_error = true;
} else {
wait(delay(v));
}
}
continue;
}
if (tokencmp(tokens[0], "status")) {
// Warn at 7 seconds since status will spend as long as 5 seconds trying to read/write from the database
warn = timeWarning( 7.0, "\nWARNING: Long delay (Ctrl-C to interrupt)\n" );