Skip to content

Conversation

@konst-aa
Copy link

@konst-aa konst-aa commented Jun 5, 2022

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 at heir_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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant