Skip to content

Commit

Permalink
fix: Sleep for some seconds after new process creation
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanpaudel93 committed Mar 17, 2024
1 parent a43ffd8 commit 522a050
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/lib/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ export async function deployContract({ name, walletPath, contractPath }: DeployA
]
const data = '1984'

if (!processId)
if (!processId) {
processId = await spawn({ module, signer, tags, data, scheduler })
await sleep()
}

const contractSrc = loadContract(contractPath)

await sleep()

// Load contract to process
const messageId = await retry(
async () =>
Expand Down
6 changes: 4 additions & 2 deletions src/lib/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import path from 'node:path'
import fs from 'node:fs'
import process from 'node:process'

// @ts-expect-error type missing
import createFileTree from 'pretty-file-tree'
import chalk from 'chalk'
import ora from 'ora'
Expand Down Expand Up @@ -46,7 +48,7 @@ export function createProjectStructure(mainFile: string, cwd: string) {
.map(v => ` ${v}`)
.join('\n')

const requiresInMod = findRequires(modules[i].content, cwd)
const requiresInMod = findRequires(modules[i].content!, cwd)

requiresInMod.forEach((mod) => {
const existingMod = modules.find(m => m.name === mod.name)
Expand Down Expand Up @@ -78,7 +80,7 @@ export function createProjectStructure(mainFile: string, cwd: string) {
return orderedModules
}

function findRequires(data: string, cwd: string) {
function findRequires(data: string, cwd: string): Module[] {
const requirePattern = /(?<=(require( *)(\n*)(\()?( *)("|'))).*(?=("|'))/g
const requiredModules = data.match(requirePattern)?.map(
mod => ({
Expand Down

0 comments on commit 522a050

Please sign in to comment.