Skip to content

Conversation

@hcg1314
Copy link
Contributor

@hcg1314 hcg1314 commented Nov 15, 2019

IPFS daemon will create a IDENTITY for repo through function GenerateKeyPairWithReader. This action cost so much CPU resource. And IPFS daemon creates a fake repo for each ipfs add -n xxx.
So, i create a global fake node, all the calls ipfs add -n xxx can use this fake node to avoid GenerateKeyPairWithReader.

return nilNode,nil
}

func CloseFakeRepo() error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't bother with this. We don't actually need to close this node.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Ideally we wouldn't even need a "nil node" but this looks like a good interim solution.


type UnixfsAPI CoreAPI
var nilNode *core.IpfsNode
var lock sync.Mutex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use a sync.Once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@Stebalien Stebalien merged commit 8c35862 into ipfs:master Nov 18, 2019
@Stebalien
Copy link
Member

Thanks!

@hcg1314 hcg1314 deleted the fix/6760 branch November 19, 2019 00:42
This was referenced Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants