Closed james-cobb closed 6 years ago
Possible solution is to remove registry entries in the await() method, in this branch:
This looks good! One option could be to remove the two remove calls and replace both with a single one inside a finally block
Yes, I had thought about using finally - but wan't sure on the behaviour if the exception is rethrown in the catch. Wanted to double check the finally is still called, and when (if the exception is caught further up, are any other catches executed before this finally, and which is preferred).
Needed a quick solution (currently in use under heavy load in a production environment!), will give some further thought to the best catch - finally structure, and make a PR.
I'm currently stuck in NodeJS land due to work. The Kotlin version of ProtoActor could really use some love so I've sent an invite if you want to join in.
@james-cobb are you still using this? I'm trying to get some time in to fix the current issue list
Yes, the current PR is still in use in production, has fixed the issue, and is stable.
Using a finally clause should work just as well, and seems neater. But I think the current solution actually makes the precise behaviour more explicit, at the expense of a duplicated line of code.
👍 Thanks, pulled it all in. marking this as closed
DeferredProcess adds itself to the process registry on creation. But this is entry is never removed. The Process Registry uses a map with strong references, so completed deferred processes are never garbage collected.