Skip to content

make_numbered_dir() multi-process-safe #30

Closed
@pytestbot

Description

@pytestbot

py.path.local.make_numbered_dir() has a race condition that only shows up if more than "keep" processes start up at exactly the same time (which could occur when starting tests in parallel).

The fix I provide here, while not theoretically perfect, should be good enough. It prevents very recent directories from being deleted (even if they don't have (yet?) a .lock file in them). For what "very recent" means, I suppose that any value greater than 1 second is good enough, but I personally like to have enough time to get a chance to copy a directory that I want to keep, so the patch uses 5 minutes as the default.

https://bitbucket.org/pypy/pypy/commits/c6f52c21fe7e0e5385764cb5b1013cfbc39884be

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions