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

[FTP ext] Close connection #1324

Merged
merged 10 commits into from
Jun 8, 2021
Merged

[FTP ext] Close connection #1324

merged 10 commits into from
Jun 8, 2021

Conversation

tiantn
Copy link
Contributor

@tiantn tiantn commented May 20, 2021

Proposed changes

Release Notes

Milestone:

Changelog:

Types of changes

What types of changes does your code introduce to Zowe Explorer?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Updates to Documentation or Tests (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This checklist will be used as reference for both the contributor and the reviewer

  • I have read the CONTRIBUTOR GUIDANCE wiki
  • PR title follows Conventional Commits Guidelines
  • PR Description is included
  • gif or screenshot is included if visual changes are made
  • yarn workspace vscode-extension-for-zowe vscode:prepublish has been executed
  • All checks have passed (DCO, Jenkins and Code Coverage)
  • I have added unit test and it is passing
  • I have added integration test and it is passing
  • There is coverage for the code that I have added
  • I have tested it manually and there are no regressions found
  • I have added necessary documentation (if appropriate)
  • Any PR dependencies have been merged and published (if appropriate)

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

tiantn added 4 commits May 17, 2021 16:37
Signed-off-by: tian na <tiantn@cn.ibm.com>
Signed-off-by: tian na <tiantn@cn.ibm.com>
Signed-off-by: tian na <tiantn@cn.ibm.com>
Signed-off-by: tian na <tiantn@cn.ibm.com>
@jellypuno jellypuno changed the title Close connection [FTP ext] Close connection May 20, 2021
@lauren-li
Copy link
Contributor

Summary of changes in this PR:
This PR addresses issue #1196 (FTP Extension - Numerous FTP tasks started on the host) by doing the following:

  1. Add the releaseConnection function that closes a connection.
  2. Wrap each FTP operation in a try/finally statement.
  3. CallrelaseConnection in the finally block to close the connection at the end of each FTP operation.

@tiantn @std4lqi Please correct me if any of the above is wrong or incomplete. Thanks!

@tiantn
Copy link
Contributor Author

tiantn commented May 26, 2021

Summary of changes in this PR:
This PR addresses issue #1196 (FTP Extension - Numerous FTP tasks started on the host) by doing the following:

1. Add the `releaseConnection` function that closes a connection.

2. Wrap each FTP operation in a `try`/`finally` statement.

3. Call`relaseConnection` in the `finally` block to close the connection at the end of each FTP operation.

@tiantn @std4lqi Please correct me if any of the above is wrong or incomplete. Thanks!

Hi @lauren-li, I think you are correct. Thank you!

@crawr crawr added this to the 1.16.0 Release milestone May 27, 2021
Signed-off-by: Lauren Li <45975633+lauren-li@users.noreply.github.com>
@lauren-li
Copy link
Contributor

@tiantn The code on this branch looks good to me so far. I've made a PR into your close-connection branch to update it with the latest changes in Zowe Explorer's master branch: https://github.com/tiantn/vscode-extension-for-zowe/pull/1

Could you please use this to bring your PR up-to-date with master branch? (Or, if it's easier for you, feel free to directly update your close-connection branch instead.) Apologies for the trouble, and thank you for all your work on this!

Close connection - update with master
@tiantn
Copy link
Contributor Author

tiantn commented May 31, 2021

@tiantn The code on this branch looks good to me so far. I've made a PR into your close-connection branch to update it with the latest changes in Zowe Explorer's master branch: tiantn#1

Could you please use this to bring your PR up-to-date with master branch? (Or, if it's easier for you, feel free to directly update your close-connection branch instead.) Apologies for the trouble, and thank you for all your work on this!

Thank you @lauren-li ! Thank you for helping resolving the conflicts. 😊

@katelynienaber
Copy link
Contributor

katelynienaber commented Jun 4, 2021

@lauren-li @tiantn Hello, sorry for lateness. I wanted to get some help from @VitGottwald with testing this.

It seems to me that the issue described in that bug is still occurring. I tested it using the setup described in the related issue (new FTP profile, used in USS tree to open/create/delete folders & files) and in z/OSMF I still get a large list of new jobs (one for each action performed) which do not stop until I close VSCode.

image

@lauren-li
Copy link
Contributor

lauren-li commented Jun 4, 2021

It seems to me that the issue described in that bug is still occurring.

@katelynienaber Just to double-check, are you testing this from "Run Zowe Explorer FTP VS Code Extension"?

Screen Shot 2021-06-04 at 4 18 03 PM

(Alternatively, you can run yarn package to build the vsix file for the FTP extension, install it in VS Code, and test that way.)

Copy link
Contributor

@lauren-li lauren-li left a comment

Choose a reason for hiding this comment

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

This PR seems to fix issue #1196 for me. I see at most 1 FTP task resulting from using the Zowe Explorer FTP extension now, even if I'm opening and closing multiple files/folders and performing various searches.

However, I did encounter an ESLint error when trying to build the vsix file with yarn package. (See comment below for details.) I think this should be addressed within this PR.

Overall, I think this PR is almost ready to go. Thanks @tiantn for your hard work on this PR, and @std4lqi for your guidance!

const options = {
owner: owner,
};
const response = (await JobUtils.listJobs(connection, prefix, options)) as IJob[];
Copy link
Contributor

Choose a reason for hiding this comment

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

When running yarn package, I received the following ESLint error:

Screen Shot 2021-06-04 at 3 56 13 PM

To resolve this error, I had to delete as IJob[] from the end of line 34.

Copy link

Choose a reason for hiding this comment

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

Yes, I think as IJob[] is unnecessary now. JobUtils.listJobs returns Promise<IJob[]>. Thanks!

public static async listJobs(connection: any, prefix: string, option?: IListJobOption): Promise<IJob[]>

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you @std4lqi for confirming this. I've pushed a commit removing as IJob[] to the PR branch. (@tiantn I hope this is ok with you! I just figured it would be quicker to do a direct push since this was a small, low-risk change.)

@tiantn
Copy link
Contributor Author

tiantn commented Jun 7, 2021

It seems to me that the issue described in that bug is still occurring.

@katelynienaber Just to double-check, are you testing this from "Run Zowe Explorer FTP VS Code Extension"?

Screen Shot 2021-06-04 at 4 18 03 PM

(Alternatively, you can run yarn package to build the vsix file for the FTP extension, install it in VS Code, and test that way.)

@lauren-li @tiantn Hello, sorry for lateness. I wanted to get some help from @VitGottwald with testing this.

It seems to me that the issue described in that bug is still occurring. I tested it using the setup described in the related issue (new FTP profile, used in USS tree to open/create/delete folders & files) and in z/OSMF I still get a large list of new jobs (one for each action performed) which do not stop until I close VSCode.

image

Hi @katelynienaber , as @lauren-li suggested, you can build the vsix file for the FTP extension and install it to try again. Thank you!

katelynienaber
katelynienaber previously approved these changes Jun 7, 2021
Copy link
Contributor

@katelynienaber katelynienaber left a comment

Choose a reason for hiding this comment

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

Yes, I think I used the wrong extension >.>

This is working for me, all started tasks disappear in the MF activity log once they are completed.

@jellypuno jellypuno removed their request for review June 7, 2021 10:05
katelynienaber and others added 3 commits June 7, 2021 12:06
Signed-off-by: Lauren Li <45975633+lauren-li@users.noreply.github.com>
Copy link
Contributor

@lauren-li lauren-li left a comment

Choose a reason for hiding this comment

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

This PR looks good to me now! All unit and expected integration tests are passing, and manual testing shows that the tasks generated through using the FTP extension go away once they are complete.

Thanks @tiantn for putting this PR together, and thanks @std4lqi for helping out!

@tiantn
Copy link
Contributor Author

tiantn commented Jun 8, 2021

Thanks @lauren-li @std4lqi 😊

Copy link
Contributor

@katelynienaber katelynienaber left a comment

Choose a reason for hiding this comment

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

LGTM :)

@lauren-li lauren-li merged commit 7cf5454 into zowe:master Jun 8, 2021
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.

5 participants