Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

refactor: Prefer event emitting to promises cancelation #370

Merged
merged 6 commits into from
Nov 25, 2019

Conversation

mykola-mokhnach
Copy link
Contributor

@mykola-mokhnach mykola-mokhnach commented Nov 25, 2019

According to appium/appium#13631 we still have memory leaks due to weird promise cancelation logic. IMHO promise cancelation itself is evil in its current implementation and I would rather avoid using it.

BREAKING CHANGE: The current refactoring is breaking and changes onUnexpectedShutdown to a normal event, which is emitted by the driver when it is shut down unexpectedly. I've also checked the depending drivers and it looks like only the umbrella driver uses this promise, so we'll have to change that implementation after the major version bump

@mykola-mokhnach mykola-mokhnach changed the title [WIP] refactor: Prefer event emitting to promises cancelation refactor: Prefer event emitting to promises cancelation Nov 25, 2019
Copy link
Contributor

@imurchie imurchie left a comment

Choose a reason for hiding this comment

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

Seems like a good alternative to the crufty solution in place now.

* The function may accept one argument, which is the actual error instance, which
* caused the driver to shut down.
*/
onUnexpectedShutdown (hanlder) {
Copy link
Contributor

Choose a reason for hiding this comment

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

handler

@mykola-mokhnach
Copy link
Contributor Author

@imurchie I can also observe the TODO at https://github.com/appium/appium/blob/67e85ff02ce0d9d1237912e38b207869431e7e07/lib/appium.js#L411

which we could possible resolve by this PR

Copy link
Contributor

@imurchie imurchie left a comment

Choose a reason for hiding this comment

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

Excellent!

Copy link
Member

@jlipps jlipps left a comment

Choose a reason for hiding this comment

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

yes, this feels a lot better. thanks.

@mykola-mokhnach mykola-mokhnach merged commit 1931e77 into appium:master Nov 25, 2019
@mykola-mokhnach mykola-mokhnach deleted the rej_promise branch November 25, 2019 18:01
@imurchie imurchie mentioned this pull request Dec 11, 2019
10 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants