Skip to content

Commit

Permalink
Cleaning the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
elielnfinic committed Nov 12, 2024
1 parent 1deda57 commit a5f2d12
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
11 changes: 5 additions & 6 deletions packages/node/src/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ function updateHandler(node: TopologyNode, data: Uint8Array) {
);
};

try{
try {
_merge();
}catch(err){
} catch (err) {
if (updateMessage.vertices.length === 0) {
return false;
} else {
Expand All @@ -105,7 +105,7 @@ function updateHandler(node: TopologyNode, data: Uint8Array) {
_merge();
}
}

node.objectStore.put(object.id, object);

return true;
Expand Down Expand Up @@ -187,13 +187,12 @@ function syncAcceptHandler(
});

if (vertices.length !== 0) {
try{
try {
object.merge(vertices);
}catch(err){
} catch (err) {
node.syncObject(object.id, sender);
console.log("ERROR MERGING VERTICES");
object.merge(vertices);

}
node.objectStore.put(object.id, object);
}
Expand Down
3 changes: 0 additions & 3 deletions packages/object/src/hashgraph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,7 @@ export class HashGraph {
if (
!deps.every((dep) => this.forwardEdges.has(dep) || this.vertices.has(dep))
) {
console.log("Node ID ", nodeId);
console.error("Invalid dependency detected.");
throw new Error("Invalid dependency detected.");
return "";
}

const vertex: Vertex = {
Expand Down
16 changes: 6 additions & 10 deletions packages/object/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,12 @@ export class TopologyObject implements ITopologyObject {
if (!vertex.operation) {
continue;
}
try{
this.hashGraph.addVertex(
vertex.operation,
vertex.dependencies,
vertex.nodeId,
);
}catch(err){
throw new Error("Error merging vertex");
}


this.hashGraph.addVertex(
vertex.operation,
vertex.dependencies,
vertex.nodeId,
);
}

const operations = this.hashGraph.linearizeOperations();
Expand Down

0 comments on commit a5f2d12

Please sign in to comment.