Skip to content
Merged
Show file tree
Hide file tree
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 package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "polykey",
"version": "2.3.4",
"version": "2.3.5",
"homepage": "https://polykey.com",
"author": "Matrix AI",
"contributors": [
Expand Down
72 changes: 40 additions & 32 deletions src/nodes/NodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class NodeManager<Manifest extends AgentClientManifestNodeManager> {
connectedTime: Date.now(),
scopes: ['global'],
},
true,
false,
false,
);
};
Expand Down Expand Up @@ -707,7 +707,6 @@ class NodeManager<Manifest extends AgentClientManifestNodeManager> {
}

while (true) {
ctx.signal.throwIfAborted();
const isDone = await nodeConnectionsQueue.withNodeSignal(
async (nodeIdTarget, nodeIdSignaller) => {
let nodeConnection: NodeConnection<Manifest> | undefined;
Expand Down Expand Up @@ -849,7 +848,6 @@ class NodeManager<Manifest extends AgentClientManifestNodeManager> {
}

while (true) {
ctx.signal.throwIfAborted();
const isDone = await nodeConnectionsQueue.withNodeDirect(
async (nodeIdTarget, nodeContact) => {
if (!this.nodeConnectionManager.hasConnection(nodeIdTarget)) {
Expand Down Expand Up @@ -924,7 +922,6 @@ class NodeManager<Manifest extends AgentClientManifestNodeManager> {
throw e;
});
}

if (!connectionMade) {
throw new nodesErrors.ErrorNodeManagerFindNodeFailed(
'failed to find node via direct',
Expand Down Expand Up @@ -1312,8 +1309,8 @@ class NodeManager<Manifest extends AgentClientManifestNodeManager> {
@decorators.context ctx: ContextTimed,
): Promise<void> {
if (tran == null) {
return this.db.withTransactionF((tran) => {
return this.claimNode(targetNodeId, tran);
return await this.db.withTransactionF(async (tran) => {
return await this.claimNode(targetNodeId, tran);
});
}
const [, claim] = await this.sigchain.addClaim(
Expand Down Expand Up @@ -1515,8 +1512,9 @@ class NodeManager<Manifest extends AgentClientManifestNodeManager> {
tran?: DBTransaction,
): Promise<AgentRPCResponseResult<AgentClaimMessage>> {
if (tran == null) {
return this.db.withTransactionF((tran) =>
this.handleClaimNetwork(requestingNodeId, input, tran),
return await this.db.withTransactionF(
async (tran) =>
await this.handleClaimNetwork(requestingNodeId, input, tran),
);
}
const signedClaim = claimsUtils.parseSignedClaim(input.signedTokenEncoded);
Expand Down Expand Up @@ -1546,8 +1544,9 @@ class NodeManager<Manifest extends AgentClientManifestNodeManager> {
tran?: DBTransaction,
): Promise<AgentRPCResponseResult<{ success: true }>> {
if (tran == null) {
return this.db.withTransactionF((tran) =>
this.handleVerifyClaimNetwork(requestingNodeId, input, tran),
return await this.db.withTransactionF(
async (tran) =>
await this.handleVerifyClaimNetwork(requestingNodeId, input, tran),
);
}
const signedClaim = claimsUtils.parseSignedClaim(input.signedTokenEncoded);
Expand Down Expand Up @@ -1680,17 +1679,18 @@ class NodeManager<Manifest extends AgentClientManifestNodeManager> {
}

if (tran == null) {
return this.db.withTransactionF((tran) =>
this.setNode(
nodeId,
nodeAddress,
nodeContactAddressData,
block,
force,
connectionConnectTimeoutTime,
tran,
ctx,
),
return await this.db.withTransactionF(
async (tran) =>
await this.setNode(
nodeId,
nodeAddress,
nodeContactAddressData,
block,
force,
connectionConnectTimeoutTime,
tran,
ctx,
),
);
}

Expand Down Expand Up @@ -1824,13 +1824,14 @@ class NodeManager<Manifest extends AgentClientManifestNodeManager> {
tran?: DBTransaction,
): Promise<void> {
if (tran == null) {
return this.db.withTransactionF((tran) =>
this.garbageCollectBucket(
bucketIndex,
connectionConnectTimeoutTime,
ctx,
tran,
),
return await this.db.withTransactionF(
async (tran) =>
await this.garbageCollectBucket(
bucketIndex,
connectionConnectTimeoutTime,
ctx,
tran,
),
);
}

Expand Down Expand Up @@ -2041,8 +2042,8 @@ class NodeManager<Manifest extends AgentClientManifestNodeManager> {

protected async setupRefreshBucketTasks(tran?: DBTransaction) {
if (tran == null) {
return this.db.withTransactionF((tran) =>
this.setupRefreshBucketTasks(tran),
return await this.db.withTransactionF(
async (tran) => await this.setupRefreshBucketTasks(tran),
);
}

Expand Down Expand Up @@ -2149,8 +2150,15 @@ class NodeManager<Manifest extends AgentClientManifestNodeManager> {
@decorators.context ctx: ContextTimed,
): Promise<Task> {
if (tran == null) {
return this.db.withTransactionF((tran) =>
this.updateRefreshBucketDelay(bucketIndex, delay, lazy, tran, ctx),
return await this.db.withTransactionF(
async (tran) =>
await this.updateRefreshBucketDelay(
bucketIndex,
delay,
lazy,
tran,
ctx,
),
);
}

Expand Down