Cleanup instances on shutdown#3
Cleanup instances on shutdown#3jeffglover wants to merge 2 commits intoborgstrom:masterfrom jeffglover:patch-1
Conversation
In the context of, https://github.com/NerdWalletOSS/kinesis-python, if multiple SubprocessLoop instances are created and and shutdown during a long running process eventually you'll hit `OSError: [Errno 24] Too many open files`. This ensures the instances are cleaned up while running.
Codecov Report
@@ Coverage Diff @@
## master #3 +/- ##
=========================================
+ Coverage 92.13% 92.3% +0.17%
=========================================
Files 2 2
Lines 89 91 +2
=========================================
+ Hits 82 84 +2
Misses 7 7
Continue to review full report at Codecov.
|
borgstrom
left a comment
There was a problem hiding this comment.
Can you please also add test that asserts the instances getting removed?
borgstrom
left a comment
There was a problem hiding this comment.
Sorry, I tried to add this comment to my last review but I guess I didn't save it correctly...
| while self in self._INSTANCES: | ||
| self._INSTANCES.remove(self) |
There was a problem hiding this comment.
_INSTANCES is a class attribute, so this should be:
while self in self.__class__._INSTANCES:
self.__class__._INSTANCES.remove(self)|
@borgstrom can this be merged ? |
|
@ngsharsha - Not yet. My comment about We don't run into this situation in our use of kinesis-python so I haven't had a driving force to complete this. If you want to add tests and address my comment in a new PR I would be happy to review/merge. |
|
This totally fell off my radar a long time ago. Since AWS kinesis can now trigger lambdas, I don't really have a need for it. I'll try to get to it this week so at least the fix gets in. I'm not opposed to someone taking it over though. |
In the context of, https://github.com/NerdWalletOSS/kinesis-python, if multiple SubprocessLoop instances are created and and shutdown during a long running process eventually you'll hit
OSError: [Errno 24] Too many open files. This ensures the instances are cleaned up while running.