diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-04-17 16:32:40 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-04-17 17:22:32 -0700 |
| commit | 944adeb2f9ca31c1a6cb7a8497555d97ea0e51d8 (patch) | |
| tree | dfc03dae93def8af1036294cfd6310032e4d07dc /internal/cp | |
| parent | 842398c670ab22faf598dbc6f7530b6cc53cfa40 (diff) | |
| download | ccp-944adeb2f9ca31c1a6cb7a8497555d97ea0e51d8.tar.zst | |
No more Elm Architecture
Diffstat (limited to 'internal/cp')
| -rw-r--r-- | internal/cp/cp.go | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/internal/cp/cp.go b/internal/cp/cp.go index 7ad80f7..7d32163 100644 --- a/internal/cp/cp.go +++ b/internal/cp/cp.go @@ -10,7 +10,6 @@ import ( "path" "slices" "strings" - "time" "github.com/rhogenson/ccp/internal/wfs" "github.com/rhogenson/ccp/internal/wfs/sftpfs" @@ -127,9 +126,8 @@ func (p FSPath) exists() bool { } type copier struct { - p Progress - force bool - fileStartRateLimit *time.Ticker + p Progress + force bool } func (c *copier) openWithRetry(path FSPath, fn func() error) error { @@ -143,11 +141,7 @@ func (c *copier) openWithRetry(path FSPath, fn func() error) error { } func (c *copier) copyRegularFile(src, dst FSPath) error { - select { - case <-c.fileStartRateLimit.C: - c.p.FileStart(src.String(), dst.String()) - default: - } + c.p.FileStart(src.String(), dst.String()) in, err := src.open() if err != nil { @@ -220,11 +214,9 @@ func Copy(progress Progress, srcs []FSPath, dstRoot FSPath, force bool) { // sem acts as a semaphore to limit the number of concurrent file copies sem := make(chan struct{}, maxConcurrency) c := &copier{ - p: progress, - force: force, - fileStartRateLimit: time.NewTicker(500 * time.Millisecond), + p: progress, + force: force, } - defer c.fileStartRateLimit.Stop() type roDir struct { path FSPath mode fs.FileMode |
