Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch @ulixee/hero-core@2.0.0-alpha.25 for the project I'm working on.
Work has previously been done to disable auto-shutdown of idle connections here: https://github.com/ulixee/hero/pull/199 and the method introduced to check for idle timeout ms fails in the edge cases when the hero connection has already disconnected due to an error.
I'm mitigating this issue by adding the clearIdleConnectionsAfterMillis property to the connectionToHero object that is copied from the core instance during the constructor, that way the value is still accessible after this.core is cleared out on disconnect.
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
@ulixee/hero-core@2.0.0-alpha.25
for the project I'm working on.Work has previously been done to disable auto-shutdown of idle connections here: https://github.com/ulixee/hero/pull/199 and the method introduced to check for idle timeout ms fails in the edge cases when the hero connection has already disconnected due to an error.
I observed the following in the logs:
I traced the cause to this line where
this.core
is set to null on disconnect: https://github.com/ulixee/hero/blob/main/core/connections/ConnectionToHeroClient.ts#L167The checkForAutoshutdown is bound to the close event here https://github.com/ulixee/hero/blob/main/core/connections/ConnectionToHeroClient.ts#L202
Which then blows up when trying to retrieve the timeout ms from the core object here https://github.com/ulixee/hero/blob/main/core/connections/ConnectionToHeroClient.ts#L202
I'm mitigating this issue by adding the
clearIdleConnectionsAfterMillis
property to the connectionToHero object that is copied from the core instance during the constructor, that way the value is still accessible after this.core is cleared out on disconnect.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.