Skip to content

Commit

Permalink
Add timeout with promise to catch grace period error
Browse files Browse the repository at this point in the history
  • Loading branch information
samaradel committed Dec 2, 2024
1 parent b674138 commit ff6bbd2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,11 @@ export default {
id: node?.rentContractId,
});
if (state.gracePeriod) {
throw `You can't deploy on node ${node.nodeId}, its rent contract is in grace period.`;
await new Promise((_, reject) => {
setTimeout(() => {
reject(Error(`You can't deploy on node ${node.nodeId}, its rent contract is in grace period.`));
}, 2000);
});
}
}
} catch (error) {
Expand Down
6 changes: 5 additions & 1 deletion packages/playground/src/utils/nodeSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ export async function validateRentContract(
id: node.rentContractId,
});
if (contractInfo.state.gracePeriod) {
throw `You can't deploy on node ${node.nodeId}, its rent contract is in grace period.`;
await new Promise((_, reject) => {
setTimeout(() => {
reject(Error(`You can't deploy on node ${node.nodeId}, its rent contract is in grace period.`));
}, 2000);
});
}
}

Expand Down

0 comments on commit ff6bbd2

Please sign in to comment.