mirror of
https://github.com/foomo/gofuncy.git
synced 2025-10-16 12:25:41 +00:00
wip: close chan
This commit is contained in:
parent
e268779e11
commit
3d9da4ba7a
11
go.go
11
go.go
@ -145,13 +145,13 @@ func Go(fn Func, opts ...Option) <-chan error {
|
||||
}
|
||||
}
|
||||
|
||||
errChan := make(chan error)
|
||||
errChan := make(chan error, 1)
|
||||
go func(o *Options, errChan chan<- error) {
|
||||
var err error
|
||||
defer func() {
|
||||
o.l.Info("gofuncy --> closing chan")
|
||||
close(errChan)
|
||||
o.l.Info("gofuncy --> closing chan done")
|
||||
o.l.Info("gofuncy --> closing chan")
|
||||
}()
|
||||
ctx := o.ctx
|
||||
start := time.Now()
|
||||
@ -187,11 +187,12 @@ func Go(fn Func, opts ...Option) <-chan error {
|
||||
}
|
||||
ctx = injectParentRoutineIntoContext(ctx, RoutineFromContext(ctx))
|
||||
ctx = injectRoutineIntoContext(ctx, o.name)
|
||||
o.l.Info("gofuncy --> calling")
|
||||
l.Info("gofuncy --> calling")
|
||||
err = fn(ctx)
|
||||
o.l.Info("gofuncy --> done")
|
||||
defer o.l.Info("gofuncy --> out")
|
||||
l.Info("gofuncy --> done")
|
||||
defer l.Info("gofuncy --> out")
|
||||
errChan <- err
|
||||
l.Info("gofuncy <-- done")
|
||||
}(o, errChan)
|
||||
|
||||
o.l.Info("gofuncy --> returning")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user