Skip to content

Defer FanoutCache temp directory until first use - #384

Closed
Eryx-Z wants to merge 1 commit into
grantjenks:masterfrom
Eryx-Z:fix/fanout-defer-tempdir
Closed

Eryx-Z wants to merge 1 commit into
grantjenks:masterfrom
Eryx-Z:fix/fanout-defer-tempdir

Conversation

@Eryx-Z

@Eryx-Z Eryx-Z commented Oct 17, 2026

Copy link
Copy Markdown

Summary

When directory is omitted, postpone tempfile.mkdtemp and shard construction until the cache is first used (or entered as a context manager). Importing a module that constructs FanoutCache() at module level no longer creates temporary directories as a side effect.

Test plan

  • New tests: deferred mkdtemp until first write; close() before use is a no-op
  • pytest tests/test_fanout.py -o addopts= → 44 passed

Fixes #379

When directory is omitted, postpone tempfile.mkdtemp and shard
construction until the cache is first used (or entered as a context
manager). Importing a module that constructs FanoutCache() at module
level no longer creates temporary directories as a side effect.

Fixes grantjenks#379
@Eryx-Z

Eryx-Z commented Oct 17, 2026

Copy link
Copy Markdown
Author

Closing for now.

@Eryx-Z Eryx-Z closed this Oct 17, 2026
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.

Postpone side effect on Fanout cache instantiation

1 participant