Skip to content

Commit

Permalink
NXDRIVE-2711:Show that upload is still alive for very large files
Browse files Browse the repository at this point in the history
  • Loading branch information
swetayadav1 committed Oct 25, 2023
1 parent ab433bb commit 894e6a6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
3 changes: 2 additions & 1 deletion docs/changes/5.3.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Release date: `2023-xx-xx`
- Upgraded `typing-extensions` from 4.0.1 to 4.7.1
- Upgraded `vulture` from 2.3 to 2.9.1
- Upgraded `wcwidth` from 0.2.5 to 0.2.6

## Technical Changes

-
- Added `finalizing_status` attribute in LinkingAction class
8 changes: 3 additions & 5 deletions nxdrive/client/uploader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ def link_blob_to_doc(
engine=transfer.engine,
doc_pair=transfer.doc_pair,
)
action.finalizing_status = ""
action.is_direct_transfer = transfer.is_direct_transfer
if "headers" in kwargs:
kwargs["headers"].update(headers)
Expand All @@ -462,10 +461,9 @@ def link_blob_to_doc(
err = f"Error while linking blob to doc: {exc!r}"
log.warning(err)
action.finalizing_status = "Error"
if "TCPKeepAliveHTTPSConnectionPool" in str(exc):
raise exc
transfer.request_uid = str(uuid4())
self.dao.update_upload_requestid(transfer)
if "TCPKeepAliveHTTPSConnectionPool" not in str(exc):
transfer.request_uid = str(uuid4())
self.dao.update_upload_requestid(transfer)
raise exc
finally:
action.finish_action()
Expand Down
20 changes: 7 additions & 13 deletions nxdrive/engine/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@
class Action(QObject):
actions: Dict[int, Optional["Action"]] = {}

def __init__(
self, action_type: str, /, *, progress: float = 0.0, finalizing_status: str = ""
) -> None:
def __init__(self, action_type: str, /, *, progress: float = 0.0) -> None:
super().__init__()

self.type = action_type
self._progress = progress
self._finalizing_status = finalizing_status

self.size = 0
self.uid = str(uuid.uuid4())
Expand All @@ -46,14 +43,6 @@ def progress(self, value: float, /) -> None:
def get_percent(self) -> float:
return self.progress

@property
def finalizing_status(self) -> str:
return self._finalizing_status

@finalizing_status.setter
def finalizing_status(self, value: str, /) -> None:
self._finalizing_status = value

@staticmethod
def get_actions() -> Dict[int, Optional["Action"]]:
return Action.actions.copy()
Expand All @@ -77,7 +66,6 @@ def export(self) -> Dict[str, Any]:
"uid": self.uid,
"action_type": self.type,
"progress": self.get_percent(),
"finalizing_status": self.finalizing_status,
}

def __repr__(self) -> str:
Expand Down Expand Up @@ -279,6 +267,12 @@ def __init__(
)
self.progress = size

def export(self) -> Dict[str, Any]:
return {
**super().export(),
"finalizing_status": self.finalizing_status,
}


def tooltip(doing: str): # type: ignore
def action_decorator(func): # type: ignore
Expand Down

0 comments on commit 894e6a6

Please sign in to comment.