This repository has been archived by the owner on May 15, 2024. It is now read-only.
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.
feat: add cleanup test, and isolate id mapping code and cleanup code #218
feat: add cleanup test, and isolate id mapping code and cleanup code #218
Changes from all commits
018be8a
92d6a6a
68421c6
26f6be4
664821e
6229fca
d6193a9
7adcc08
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this until after the first call to
cs.clenaup(ctx)
, to line 57, so that the timer does not start until after the first cleanup is done.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it in this order because after the initial call, the behavior of the ticker is to tick
x duration
after the start of the previous cleanup, not after the end of the previous cleanup. so this way the behavior stays consistent with the regular loop, and cleanups will happen at predictable times.if it is desired to start waiting for the duration after the previous cleanup finishes instead of immediately after it starts, we would probably have to replace the ticker with a timer that is manually scheduled at the end of a cleanup. lmk what u think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see.
Would be nice to put the
defer ticker.Stop()
right after the ticker is created to make clear it is stopped at exit.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it fix the warning by not returning an error here? It is reasonable to not return file-not-found error when removing a file, since it is already removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the error isn't related to the return type, the function just isn't called anywhere yet and the linter doesn't like private functions that are unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively, i could make this struct and its methods public to get rid of the warning? does it make sense to be public though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not export (make public) anything unless really needed. Otherwise, it risks becoming an API we need to support.
Fine like it is then