Skip to content

Commit

Permalink
Fixed various upgrade issues (#8297)
Browse files Browse the repository at this point in the history
  • Loading branch information
qstokkink authored Dec 2, 2024
2 parents edccf08 + 03ce665 commit b3bd53d
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 160 deletions.
2 changes: 1 addition & 1 deletion src/tribler/core/knowledge/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def on_message(self, peer: Peer, raw: RawStatementOperationMessage) -> None:
operation=operation)
self.validate_operation(operation)

with db_session():
with db_session(serializable=True):
is_added = self.db.knowledge.add_operation(operation, signature.signature)
if is_added:
s = f"+ operation added ({operation.object!r} \"{operation.predicate}\" {operation.subject!r})"
Expand Down
5 changes: 4 additions & 1 deletion src/tribler/core/versioning/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_versions(self) -> list[str]:
Get all versions in our state directory.
"""
return [p for p in os.listdir(self.config.get("state_dir"))
if os.path.isdir(os.path.join(self.config.get("state_dir"), p))]
if os.path.isdir(os.path.join(self.config.get("state_dir"), p)) and p != "dlcheckpoints"]

async def check_version(self) -> str | None:
"""
Expand Down Expand Up @@ -103,6 +103,9 @@ def perform_upgrade(self) -> None:
"""
Upgrade old database/download files to our current version.
"""
if self.task_manager.get_task("Upgrade") is not None:
logger.warning("Ignoring upgrade request: already upgrading.")
return
src_dir = Path(self.config.get("state_dir")) / FROM
dst_dir = Path(self.config.get_version_state_dir())
self.task_manager.register_executor_task("Upgrade", upgrade, self.config,
Expand Down
6 changes: 6 additions & 0 deletions src/tribler/ui/src/pages/Settings/Versions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ export default function Versions() {
}
}
case 2: {
const isUpgrading = await triblerService.isUpgrading();
if (!(isUpgrading === undefined) && !isErrorDict(isUpgrading)) {
setIsUpgrading(isUpgrading);
} else {
break; // Don't bother the user on error, just initialize later.
}
const canUpgrade = await triblerService.canUpgrade();
if (!(canUpgrade === undefined) && !isErrorDict(canUpgrade)) {
setCanUpgrade(canUpgrade);
Expand Down
Loading

0 comments on commit b3bd53d

Please sign in to comment.