Tweak timing and retry on copy error.
This commit is contained in:
parent
9654c6c3f3
commit
4ab2371198
2
go.mod
2
go.mod
|
@ -2,4 +2,4 @@ module git.wow.st/gmp/goget
|
|||
|
||||
go 1.23.0
|
||||
|
||||
require git.wow.st/gmp/ohlc v0.0.0-20241115023606-83f41a06596c // indirect
|
||||
require git.wow.st/gmp/ohlc v0.0.0-20241115230120-714064615eb3 // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -1,2 +1,4 @@
|
|||
git.wow.st/gmp/ohlc v0.0.0-20241115023606-83f41a06596c h1:etBdVfh2E4k00IzRBMuHsGm5HZg7S96JBZQpCGWshNE=
|
||||
git.wow.st/gmp/ohlc v0.0.0-20241115023606-83f41a06596c/go.mod h1:QSSqMCu9AFoYtfqA9Hbfpxy3mp5MT/d4fk0AzYnuoo8=
|
||||
git.wow.st/gmp/ohlc v0.0.0-20241115230120-714064615eb3 h1:HDrgOSn1k2EzP0XIZbToUvwW3GXmZSnddq+/Zv2R4Mc=
|
||||
git.wow.st/gmp/ohlc v0.0.0-20241115230120-714064615eb3/go.mod h1:QSSqMCu9AFoYtfqA9Hbfpxy3mp5MT/d4fk0AzYnuoo8=
|
||||
|
|
9
main.go
9
main.go
|
@ -12,12 +12,12 @@ import (
|
|||
|
||||
var (
|
||||
retries = 5
|
||||
concurrency = 30
|
||||
concurrency = 1
|
||||
ch chan string
|
||||
clk chan bool
|
||||
wg sync.WaitGroup
|
||||
|
||||
freq = time.Second / 30
|
||||
freq = time.Second
|
||||
throttle bool
|
||||
errs map[string]int
|
||||
mu sync.Mutex
|
||||
|
@ -61,8 +61,9 @@ func get_(symbol string) (error) {
|
|||
_, err = io.Copy(out, resp.Body)
|
||||
resp.Body.Close()
|
||||
if err != nil {
|
||||
fmt.Println("Error copying to file.")
|
||||
os.Exit(-1)
|
||||
fmt.Printf("%s: Error copying to file.", symbol)
|
||||
err_(symbol,1)
|
||||
return fmt.Errorf("%s", resp.Status)
|
||||
}
|
||||
out.WriteString("\n")
|
||||
out.Close()
|
||||
|
|
Loading…
Reference in New Issue
Block a user