increase timeouts

pull/1585/head
filip mertens 3 years ago
parent c8fc9fc18c
commit 75a689a362
  1. 14
      apps/remix-ide/src/app/files/dgitProvider.js
  2. 1
      apps/remix-ide/src/remixEngine.js

@ -34,7 +34,7 @@ class DGitProvider extends Plugin {
ipfsurl: 'https://ipfs.remixproject.org/ipfs/' ipfsurl: 'https://ipfs.remixproject.org/ipfs/'
} }
this.globalIPFSConfig = { this.globalIPFSConfig = {
host: 'ipfs.io', host: 'ipfs2.io',
port: 443, port: 443,
protocol: 'https', protocol: 'https',
ipfsurl: 'https://ipfs.io/ipfs/' ipfsurl: 'https://ipfs.io/ipfs/'
@ -417,9 +417,12 @@ class DGitProvider extends Plugin {
const ipfs = IpfsHttpClient(config) const ipfs = IpfsHttpClient(config)
let result = false let result = false
try { try {
const data = ipfs.get(cid, { timeout: 10000 }) console.log('try ', config)
const data = ipfs.get(cid, { timeout: 60000 })
console.log(config, cid, workspace, data)
for await (const file of data) { for await (const file of data) {
if (file.path) result = true if (file.path) result = true
console.log(file.path)
file.path = file.path.replace(cid, '') file.path = file.path.replace(cid, '')
if (!file.content) { if (!file.content) {
continue continue
@ -431,12 +434,13 @@ class DGitProvider extends Plugin {
const dir = path.dirname(file.path) const dir = path.dirname(file.path)
try { try {
this.createDirectories(`${workspace.absolutePath}/${dir}`) this.createDirectories(`${workspace.absolutePath}/${dir}`)
} catch (e) { } } catch (e) { console.log(e)}
try { try {
window.remixFileSystem.writeFileSync(`${workspace.absolutePath}/${file.path}`, Buffer.concat(content) || new Uint8Array()) window.remixFileSystem.writeFileSync(`${workspace.absolutePath}/${file.path}`, Buffer.concat(content) || new Uint8Array())
} catch (e) { } } catch (e) {console.log(e) }
} }
} catch (e) { } catch (e) {
console.log(e)
} }
return result return result
} }
@ -462,7 +466,7 @@ class DGitProvider extends Plugin {
const cid = cmd.cid const cid = cmd.cid
await this.call('filePanel', 'createWorkspace', `workspace_${Date.now()}`, false) await this.call('filePanel', 'createWorkspace', `workspace_${Date.now()}`, false)
const workspace = await this.call('filePanel', 'getCurrentWorkspace') const workspace = await this.call('filePanel', 'getCurrentWorkspace')
const result = await this.importIPFSFiles(this.remixIPFS, cid, workspace) || await this.importIPFSFiles(this.ipfsconfig, cid, workspace) || await this.importIPFSFiles(this.globalIPFSConfig, cid, workspace) const result = await this.importIPFSFiles(this.globalIPFSConfig, cid, workspace) || await this.importIPFSFiles(this.ipfsconfig, cid, workspace) || await this.importIPFSFiles(this.remixIPFS, cid, workspace)
await this.call('fileManager', 'refresh') await this.call('fileManager', 'refresh')
if (!result) throw new Error(`Cannot pull files from IPFS at ${cid}`) if (!result) throw new Error(`Cannot pull files from IPFS at ${cid}`)
} }

@ -10,6 +10,7 @@ export class RemixEngine extends Engine {
setPluginOption ({ name, kind }) { setPluginOption ({ name, kind }) {
if (kind === 'provider') return { queueTimeout: 60000 * 2 } if (kind === 'provider') return { queueTimeout: 60000 * 2 }
if (name === 'LearnEth') return { queueTimeout: 60000 } if (name === 'LearnEth') return { queueTimeout: 60000 }
if (name === 'dGitProvider') return { queueTimeout: 60000 * 4 }
if (name === 'slither') return { queueTimeout: 60000 * 4 } // Requires when a solc version is installed if (name === 'slither') return { queueTimeout: 60000 * 4 } // Requires when a solc version is installed
return { queueTimeout: 10000 } return { queueTimeout: 10000 }
} }

Loading…
Cancel
Save