Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit f339eba

Browse files
authored
perf: faster startup for daemon on over http api (#1528)
License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 4f805d3 commit f339eba

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/cli/commands/daemon.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict'
22

3-
const HttpAPI = require('../../http')
43
const utils = require('../utils')
54
const print = utils.print
65

@@ -32,6 +31,9 @@ module.exports = {
3231
print('Initializing daemon...')
3332

3433
const repoPath = utils.getRepoPath()
34+
35+
// Required inline to reduce startup time
36+
const HttpAPI = require('../../http')
3537
httpAPI = new HttpAPI(process.env.IPFS_PATH, null, argv)
3638

3739
httpAPI.start((err) => {

src/cli/commands/init.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict'
22

3-
const Repo = require('ipfs-repo')
4-
const IPFS = require('../../core')
53
const utils = require('../utils')
64
const print = utils.print
75

@@ -31,6 +29,10 @@ module.exports = {
3129

3230
print(`initializing ipfs node at ${path}`)
3331

32+
// Required inline to reduce startup time
33+
const IPFS = require('../../core')
34+
const Repo = require('ipfs-repo')
35+
3436
const node = new IPFS({
3537
repo: new Repo(path),
3638
init: false,

0 commit comments

Comments
 (0)