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

feat: add --enable-preload to enable/disable preloading for daemons #1909

Merged
merged 1 commit into from
Mar 6, 2019
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
5 changes: 5 additions & 0 deletions src/cli/commands/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ module.exports = {
type: 'boolean',
default: false
})
.option('enable-preload', {
type: 'boolean',
default: true
})
},

handler (argv) {
Expand All @@ -41,6 +45,7 @@ module.exports = {
repo: process.env.IPFS_PATH,
offline: argv.offline,
pass: argv.pass,
preload: { enabled: argv.enablePreload },
EXPERIMENTAL: {
pubsub: argv.enablePubsubExperiment,
ipnsPubsub: argv.enableNamesysPubsub,
Expand Down
1 change: 1 addition & 0 deletions src/core/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = self => {
options.addresses = options.addresses || []

if (!options.enabled || !options.addresses.length) {
log('preload disabled')
const api = (_, callback) => {
if (callback) {
setImmediate(() => callback())
Expand Down