Closed kevina closed 6 years ago
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.
We could do that, detecting a new repo is fairly easy though. Just check for the absence of any directories.
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.
@kevina can you handle this?
Sorry @Kubuxu I missed your message.
In any case this is now done in #35
We should detect when a repo was just created (or empty) and avoid displaying this message: