Skip to content

common: make PersistedProgress._lock a private attribute #641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pghoard/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from typing import (TYPE_CHECKING, Any, BinaryIO, Callable, Dict, Final, Optional, Protocol, Tuple, cast)

from packaging.version import Version
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, PrivateAttr
from rohmu import IO_BLOCK_SIZE, BaseTransfer, rohmufile
from rohmu.errors import Error, InvalidConfigurationError
from rohmu.typing import FileLike, HasName
Expand Down Expand Up @@ -140,7 +140,7 @@ def atomic_write(file_path: str, data: str, temp_dir: Optional[str] = None):

class PersistedProgress(BaseModel):
progress: Dict[str, ProgressData] = Field(default_factory=dict)
_lock: threading.Lock = threading.Lock()
_lock: threading.Lock = PrivateAttr(default_factory=threading.Lock)

@classmethod
def read(cls, metrics: Metrics) -> "PersistedProgress":
Expand Down
Loading