Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't display calculating datastore size on empty repo. #37

Closed
kevina opened this issue Mar 27, 2018 · 5 comments
Closed

Don't display calculating datastore size on empty repo. #37

kevina opened this issue Mar 27, 2018 · 5 comments

Comments

@kevina
Copy link
Contributor

kevina commented Mar 27, 2018

We should detect when a repo was just created (or empty) and avoid displaying this message:

Calculating datastore size. This might take 5m0s at most and will happen only once
@Stebalien
Copy link
Member

We can do this with a timeout. That is, fire off a goroutine:

done := make(chan struct{})
cancel := make(chan struct{})

go func() {
	defer close(done)
	select {
	case <-time.After(...):
    	fmt.Println(...)
    case <-cancel:
    }
}
// calculate disk usage.
close(cancel)
<-done

This way, we only spam the user when it takes more than, e.g., a second.

@kevina
Copy link
Contributor Author

kevina commented Mar 27, 2018

We could do that, detecting a new repo is fairly easy though. Just check for the absence of any directories.

@Kubuxu
Copy link
Member

Kubuxu commented Mar 28, 2018

It doesn't have to be a "new" repo. If the process takes, for example, less than 5 seconds there is no reason to bother the user.

@Kubuxu
Copy link
Member

Kubuxu commented Mar 29, 2018

@kevina can you handle this?

Stebalien added a commit to ipfs/kubo that referenced this issue Mar 29, 2018
See: ipfs/go-ds-flatfs#37

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
Stebalien added a commit to ipfs/kubo that referenced this issue Mar 29, 2018
See: ipfs/go-ds-flatfs#37

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
Stebalien added a commit to ipfs/kubo that referenced this issue Mar 29, 2018
See: ipfs/go-ds-flatfs#37

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
@kevina
Copy link
Contributor Author

kevina commented Apr 2, 2018

Sorry @Kubuxu I missed your message.

In any case this is now done in #35

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

No branches or pull requests

3 participants