passing directories between trackers and extra tests #24
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.
Problem:
When stages of processing files involve reading and writing, each stage can return a path(s) to save time. But as of right now, Temp would clean up the returned path(s) (assuming they were tracked), so returning them becomes useless.
Solution
Implement a method,
handoff(paths, heir_pid), to pass tracking of path(s) to a tracker atheir_pid. This ensures that the paths will always be cleaned up if the process whose tracker is heir_pid dies.Extra tests
Tests testing existing functionality:
"automatically cleans up"
Make an untracked directory, then track it in a different process. Refute that the directory exists after awaiting the process than waiting for 50ms.
"automatically cleans up after crashes"
Same as "automatically cleans up", but the process crashes due to a match error.
Testing handoff
Assert that the tracker for the testing process is empty.
Make and track a directory in a separate process, then hand off the directory to the tracker for the testing process.
Assert that the directory is tracked under the tracker for the testing process and that it still exists.
Cleanup the tracker
Do the same for a process that crashes, but only refute that the set of tracked directories is empty. We know for sure that the directory inside the set is the one made by the task we started with
Task.start.