-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rpc: Do not accept command while executing another one #123
Conversation
Tested ACK 0b8b653 - works as intended. A follow up would be to add a cancel/abort button. Especially for things like "waitforblock 99999999" (would even be useful for |
Combine cancel/abort functionality into already present Clear button? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One way to abort running command is to run quit
stop
. With this change this is not possible.
When did the |
I just mean it won't work anymore. I happen to use it, but can quit from the GUI. |
I'm going to address your concerns.
I cannot find the |
s/quit/stop 🤦 updated above. |
This would shutdown bitcoin-qt. Right? Why not just emulate the shell (bitcoin-cli usage) as good as possible?
This would translate that into our Qt world with:
|
0b8b653
to
980b8e9
Compare
@jonasschnelli Spotted your comment too late, so, probably, the last commit in the latest push should be dropped, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another sensible approach would be to disable the line edit while keep the 2nd command there and execute it when the 1st ends.
This deprives the user of the ability to change his mind when the 1st command output is arrived. |
980b8e9
to
e8753bf
Compare
e8753bf
to
08d599e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 08d599e, Tested on macOS 11.1 with Qt 5.15.2
Master: Allowed to input several commands at once which will lead to messy output
PR: Can only execute one command at a time
Additional Thoughts (for a followup pr)
As others have stated, it would be nice to have a cancel button on the command. This should be done in a follow up PR. An example of when this is useful:
- I want to enter the
gettxout
command - I mistakingly autocomplete to the
gettxoutsetinfo
which takes some time to run - It would be nice to be able to cancel the
gettxoutsetinfo
command ran by accident, and not have to wait until it is finished to accomplish what I set out to accomplish -> rungettxout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 08d599e, tested on Debian Sid with Qt 5.15.2.
I've generated bunch of transactions on regtest using generatetoaddress
and later used listunspent
as long-running command to reproduce issue on master, invoking multiple commands while first one is still running, and I see that PR code works as expecting afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-ACK b87a4cd after tweaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested b87a4cd on Ubuntu 20.04 Qt 5.12.8.
When executing commands enough to fill the entire result dialog, instead of scrolling down, it scrolls up to the top ("Welcome to the Bitcoin Core RPC console." line).
On the master branch, the scrolling apparently works OK.
Edit: I commented the line ui->messagesWidget->undo();
and the scrolling has returned to working normally.
connect(executor, &RPCExecutor::reply, this, [this](int category, const QString& command) {
// ui->messagesWidget->undo();
message(category, command);
m_is_executing = false;
});
re-utACK 7161395, range-diff does not show anything to actually review or test. |
Wait @hebasto, a bit off topic, should I have had to make actual GitHub review in this interface, or comment is enough? Maybe sticking to always checking all files and producing GitHub review would be "better"? |
Not sure if I understand your question in part "producing GitHub review"... Anyway, your #123 (comment) is straightforward. While reviewing pulls after rebasing I do the same locally |
In Github web interface, we can go to "Files changed" tab, check "Viewed" checkboxes on the files, and click "Review changes" -> "Submit review", which produces sort of "special" kind of "comment". Maybe it's "better" for maintainers to check for these kind of "reviews", instead of "just" a comment? |
In this project we strive to rely on GitHub as little as possible :) |
|
@jarolrod @promag @leonardojobim Do you mind having another (final?) look into at this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK cb48c59.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK cb48c59
Edit: Retracting ACK because of a silent merge conflict with #335. The signal count which is expected has changed with this PR, this signal count should be adjusted in the tests to reflect the introduction of the "Executing..."
message.
Tested functionality on Arch Linux Qt 5.15.2
and macOS 11.3 Qt 5.15.2
. Tested each commit individually, cherry-picking each on top of master. This is a nice patch. A couple of nits, no need to address unless you absolutely have to retouch. 🥃
Notes on commits:
- 9d9f7f1
- Tested that "Executing..." message is displayed and removed upon response
- 614cc38
- Concept ACK on refactoring the logic here to return early if the command is empty
- d4e7fcc
- cb48c59
- Tested that we cannot input another command while another is being executed
- Tested that we can still call the stop command
- It's annoying that this command just quits the application. It would be nice to change this in a followup.
Screenshots:
Below are screenshots showing the behavior of master vs pr. Note that one can continue to input commands on master, but cannot with this pr:
Master | Description |
---|---|
While here, clean up the command input by calling the trimmed function on the input from the command prompt.
ACK 38eb37c re-tested functionality. Ran tests to confirm this fixes the silent merge conflict with #335. Rebased $ git diff pr123.07 pr123.08
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 803946dcf..c762f2b9c 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -969,7 +969,7 @@ void RPCConsole::on_lineEdit_returnPressed()
#endif // ENABLE_WALLET
message(CMD_REQUEST, QString::fromStdString(strFilteredCmd));
- //: A message in the GUI console while an entered command being executed.
+ //: A console message indicating an entered command is currently being executed.
message(CMD_REPLY, tr("Executing…"));
m_is_executing = true;
Q_EMIT cmdRequest(cmd, m_last_wallet_model);
diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp
index c1d5f84be..cb3dbd226 100644
--- a/src/qt/test/apptests.cpp
+++ b/src/qt/test/apptests.cpp
@@ -40,7 +40,7 @@ void TestRpcCommand(RPCConsole* console)
QTest::keyClicks(lineEdit, "getblockchaininfo");
QTest::keyClick(lineEdit, Qt::Key_Return);
QVERIFY(mw_spy.wait(1000));
- QCOMPARE(mw_spy.count(), 2);
+ QCOMPARE(mw_spy.count(), 4);
QString output = messagesWidget->toPlainText();
UniValue value;
value.read(output.right(output.size() - output.lastIndexOf(QChar::ObjectReplacementCharacter) - 1).toStdString());
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK 38eb37c.
Added a dummy sleep in some call just to simplify testing.
…g another one 38eb37c qt, rpc: Do not accept command while executing another one (Hennadii Stepanov) 0c32b9c qt, rpc: Accept stop RPC even another command is executing (Hennadii Stepanov) ccf7902 qt, rpc, refactor: Return early in RPCConsole::on_lineEdit_returnPressed (Hennadii Stepanov) 5b9c8c9 qt, rpc: Add "Executing…" message (Hennadii Stepanov) Pull request description: On master (3f512f3) it is possible to enter another command while the current command is still being executed. That makes a mess in the output. With this PR: ![Screenshot from 2020-10-29 20-48-55](https://user-images.githubusercontent.com/32963518/97619690-329c0880-1a29-11eb-9f5b-6ae3c02c13b2.png) Some previous context: bitcoin-core/gui#59 (comment) --- It is still possible to enter and execute the `stop` command any time. ACKs for top commit: jarolrod: ACK 38eb37c promag: Tested ACK 38eb37c. Tree-SHA512: 2b37a4b6838bf586b1b5c878192106721f713caeb6252514a6540356aab898986396e0777e73891d331b1be797a4926c20d3f9f38ba2c984ea90d55b0c34f664
On master (3f512f3) it is possible to enter another command while the current command is still being executed. That makes a mess in the output.
With this PR:
Some previous context: #59 (comment)
It is still possible to enter and execute the
stop
command any time.