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

fix: add ability to stop containerless function #4025

Merged
merged 12 commits into from
May 11, 2022

Conversation

mohanraj-r
Copy link
Contributor

What does this PR do?

Fixes Stopping a containerless function does not kill the local process · Issue #3873 · forcedotcom/salesforcedx-vscode

What issues does this PR fix or reference?

#3873, @W-10737950@

Functionality Before

Stop Command runs successfully but the process for the function continues running.

Functionality After

Stop Command runs successfully and the underlying process for the function is not running.

Copy link
Contributor

@gbockus-sf gbockus-sf left a comment

Choose a reason for hiding this comment

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

Changes look good so far.

@mohanraj-r mohanraj-r marked this pull request as ready for review April 18, 2022 21:18
@mohanraj-r mohanraj-r requested a review from a team as a code owner April 18, 2022 21:18
@sbudhirajadoc
Copy link
Contributor

@mohanraj-r Is there a public facing string that you'd like me to review? Thanks!

@mohanraj-r
Copy link
Contributor Author

@sbudhirajadoc There are no new user facing strings in this PR. Just wanted to double-check if any changes need to be made to user docs e.g https://developer.salesforce.com/tools/vscode/en/functions/overview

Copy link
Contributor

@gbockus-sf gbockus-sf left a comment

Choose a reason for hiding this comment

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

QE:

  • Verify TS function is killed on stop ✅
  • Verify JS function is killed on stop ✅
  • Verify Java function is killed on stop ✅
  • Kills worked after invoke and debug ✅

Verified process killed two ones. 1. check for processes using ps (existing after start, gone after kill) 2. verified I was able to start another function (no port conflict).

@mohanraj-r mohanraj-r requested a review from gbockus-sf May 4, 2022 17:51
@@ -19,22 +19,27 @@ import {
import { ForceFunctionStartExecutor } from './ForceFunctionStartExecutor';

export class ForceFunctionContainerlessStartExecutor extends ForceFunctionStartExecutor {
private process: LocalRunProcess | undefined | void;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: void should encompass undefined here so I think it could just be LocalRunProcess | void

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing void results in error at this.process = await localRun.exec()

(property) ForceFunctionContainerlessStartExecutor.process: LocalRunProcess | undefined
Type 'void | LocalRunProcess' is not assignable to type 'LocalRunProcess | undefined'.
  Type 'void' is not assignable to type 'LocalRunProcess | undefined'.ts(2322)

Removing undefined results in error at private process: LocalRunProcess | void;

(property) ForceFunctionContainerlessStartExecutor.process: void | LocalRunProcess
Property 'process' has no initializer and is not definitely assigned in the constructor.ts(2564)

And looks like void can't be assigned to e.g. this.process = undefined; -> this.process = void; results in error

Copy link
Contributor

Choose a reason for hiding this comment

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

word. Thanks for trying.

Copy link
Contributor

@gbockus-sf gbockus-sf left a comment

Choose a reason for hiding this comment

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

Thanks @mohanraj-r Looks good. I ran though the QE again locally and everything worked as expected. 👍

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.

Stopping a containerless function does not kill the local process
3 participants