Skip to content
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

Remove benchmark mode, part two #115

Merged
merged 4 commits into from
Nov 9, 2022
Merged

Conversation

DeeDeeG
Copy link
Member

@DeeDeeG DeeDeeG commented Nov 4, 2022

Follow-up to PR #105.

This resolves a mistake I made on that PR, where the benchmark (--benchmark) and benchmarkTest (--benchmark-test) launch options were not passed anymore to the later parts of the startup process.

That prevented us doing checks, so as to print the relevant messages or decide based on the context whether to launch a new window or not.

  • So first and foremost, this restores the passing of those options to later in the launch process. (Which I had accidentally deleted in Remove Benchmark Startup Mode #105).
  • Also fixes a spec I wasn't sure about at the time of Remove Benchmark Startup Mode #105 being merged.
  • And ensures we log a message about benchmark mode removal on the second terminal if a second instance of the editor is launched with --benchmark or --benchmark-test mode. (Without this, it could be confusing why no new window was launched.)

cc @confused-Techie since you were the one who started #105, and the one most likely to know what this is about. Thank you for starting the work on this!

Restores earlier behavior, where if 'benchmark' or 'benchamrk-test'
flags are provided on the CLI, that is passed into some later logic
that can print a message about benchmark mode being removed,
rather than actually opening a new window with no benchmarking.

Partially reverts commit de351f1.
(Only quits if this is the first window being opened, AND launched
with the now-defunct '--benchmark' or '--benchmark-test' flag.)

(If a second instance of the editor is launched, it will coordinate
with the already-running instance to decide whether to open
a new window. In that case, we won't quit the original editor,
just print the message about the benchmarking feature being removed.)
If a new main process is launched with --benchmark mode, we have to
log quite early in the startup process, because it pretty quickly
notices the existing main process (by detecting its socket server),
and hands control of whether/how to launch any new windows to the
original, existing main process that was already running.

The new main process terminates immediately after passing the
message to the original main process about what it was trying to do.

(Particularly: it sends the first main process an encoded copy
of the options that were passed to the newer main process at launch.)

So we have to log something in the new main process quite early,
before the handoff occurs and the new main process terminates.

Otherwise, the newer terminal view won't show any info about
benchmark mode being removed, and it might not be obvious
why no new window was launched.
Update spec to expect the new behavior where benchmark mode
doesn't open a new window (only logs a message to the console).
@DeeDeeG
Copy link
Member Author

DeeDeeG commented Nov 4, 2022

There is another reasonable approach here, which would be to use these flags only to print a message, but launch the window anyway. It would be fewer lines of code and a bit simpler overall. I feel like this gets the user's attention faster to prevent any confusion, though, which is why I went with the "quitting if this is the first window" or "not launching any new windows if this is a second window" approach.

By the way, if a user attempts to launch a second window of the editor with --benchmark or --benchmark-edit, with an existing editor instance already running, then during the hand-off, the original instance will be focused/moved above other windows. At least it does that for me on Linux. And if they switch back to their terminal, they'll hopefully see the message about "benchmark mode being removed". Kinda not the best user experience, since the console.log() message is kinda buried under the original editor being focused up. Maybe the app.focus() could be suppressed, but I did not bother with that at this point.

I hope and believe that nobody really remembers that benchmark mode exists. So, polishing the user experience is probably moot anyhow. I could see the case for slimming down/eliminating this code that handles the --benchmark flag at some point.

Copy link
Member

@confused-Techie confused-Techie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad and impressed you figured out the spec issue. But otherwise think this looks fantastic, and while you're still commenting on the exact behavior of what to do when this is attempted to be used, it seems we mostly came to a good consensus on this choice on discord.

But like you said, could likely be moot at this point.

Regardless I'll approve, and see if we can get this merged, thanks for continuing the effort for me

@DeeDeeG
Copy link
Member Author

DeeDeeG commented Nov 9, 2022

Thanks for the review, merging now.

@DeeDeeG DeeDeeG merged commit 4c7f74b into master Nov 9, 2022
@DeeDeeG DeeDeeG deleted the remove-benchmark-mode-part-two branch December 5, 2022 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants