Skip to content

Commit

Permalink
Add default interval
Browse files Browse the repository at this point in the history
  • Loading branch information
aalexfvk committed Oct 25, 2023
1 parent 8d1f124 commit d6ba0c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ch_backup/logic/upload_part_observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
import time
from typing import List, Optional

from humanfriendly import parse_timespan

from ch_backup.backup.metadata.part_metadata import PartMetadata
from ch_backup.backup_context import BackupContext

DEFAULT_INTERVAL = parse_timespan("30 min")


class UploadPartObserver:
"""
Expand All @@ -18,7 +22,9 @@ def __init__(self, context: BackupContext) -> None:
self._context = context
self._last_time = time.time()
self._uploaded_parts: List[PartMetadata] = []
self._interval = self._context.config["update_metadata_interval"]
self._interval = self._context.config.get(
"update_metadata_interval", DEFAULT_INTERVAL
)

def __call__(
self, part: PartMetadata, exception: Optional[Exception] = None
Expand Down

0 comments on commit d6ba0c2

Please sign in to comment.