@@ -30,8 +30,8 @@ Waitgroup is a simplification of `sync.Waitgroup` with item and error collection
30
30
31
31
Running many short term routines over a collection with ` .Run() `
32
32
``` go
33
- import " github.com/mailgun/holster/v4/syncutils "
34
- var wg syncutils .WaitGroup
33
+ import " github.com/mailgun/holster/v4/syncutil "
34
+ var wg syncutil .WaitGroup
35
35
for _ , item := range items {
36
36
wg.Run (func (item interface {}) error {
37
37
// Do some long running thing with the item
@@ -47,9 +47,9 @@ if errs != nil {
47
47
48
48
Clean up long running routines easily with ` .Loop() `
49
49
``` go
50
- import " github.com/mailgun/holster/v4/syncutils "
50
+ import " github.com/mailgun/holster/v4/syncutil "
51
51
pipe := make (chan int32 , 0 )
52
- var wg syncutils .WaitGroup
52
+ var wg syncutil .WaitGroup
53
53
var count int32
54
54
55
55
wg.Loop (func () bool {
@@ -76,8 +76,8 @@ wg.Wait()
76
76
77
77
Loop ` .Until() ` ` .Stop() ` is called
78
78
``` go
79
- import " github.com/mailgun/holster/v4/syncutils "
80
- var wg syncutils .WaitGroup
79
+ import " github.com/mailgun/holster/v4/syncutil "
80
+ var wg syncutil .WaitGroup
81
81
82
82
wg.Until (func (done chan struct {}) bool {
83
83
select {
@@ -101,9 +101,9 @@ collects any errors from the routines once they have all completed. FanOut allow
101
101
to control how many goroutines spawn at a time while WaitGroup will not.
102
102
103
103
``` go
104
- import " github.com/mailgun/holster/v4/syncutils "
104
+ import " github.com/mailgun/holster/v4/syncutil "
105
105
// Insert records into the database 10 at a time
106
- fanOut := syncutils .NewFanOut (10 )
106
+ fanOut := syncutil .NewFanOut (10 )
107
107
for _ , item := range items {
108
108
fanOut.Run (func (cast interface {}) error {
109
109
item := cast.(Item)
0 commit comments