Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR, I propose to add some additional handling when exiting.
Background for needing this feature:
I've opted to store my data in pgsql. The current pgsql insertion implementation doesn't do any caching, so i've monkey patched my own caching methods in.
However, when restarting the collector, the data in cache is lost, since there is no opportunity to do clean up.
I've added a
stop
method to theCallback
class, as well as created a newBackendCallback
base class which all other backend callbacks inherit.The purpose of adding such handling is to allow the many types of callbacks to do some clean up where necessary.
In the
run
method ofFeedHandler
, I've added afinally
clause to the try-except statement. This is where the code will try to callstop
for all its feeds.Im not too sure if you'd like my implementation - please let me know if there's something I can change to make it better.