Compare commits
2 commits
b0cb036778
...
817a668aaf
Author | SHA1 | Date | |
---|---|---|---|
DataHoarder | 817a668aaf | ||
DataHoarder | 201b0d0879 |
|
@ -7,6 +7,7 @@ steps:
|
|||
- name: backend
|
||||
image: golang:1.19-alpine
|
||||
commands:
|
||||
- apk update && apk add --no-cache gcc musl-dev
|
||||
- GOAMD64=v2 go build -v -o srg .
|
||||
|
||||
...
|
||||
|
|
|
@ -16,6 +16,7 @@ import (
|
|||
"os"
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
type HashFileResult struct {
|
||||
|
@ -265,6 +266,11 @@ func main() {
|
|||
path := scanner.Text()
|
||||
atomic.AddInt64(&entries, 1)
|
||||
|
||||
for atomic.LoadInt64(&taskCount) >= (int64(*taskLimit) + 1) {
|
||||
runtime.Gosched()
|
||||
time.Sleep(time.Millisecond * 20)
|
||||
}
|
||||
|
||||
atomic.AddInt64(&taskCount, 1)
|
||||
go func() {
|
||||
defer atomic.AddInt64(&taskCount, -1)
|
||||
|
|
Loading…
Reference in a new issue