reducing the number of concurrent dev tools connections to Chrome

This commit is contained in:
Julien Neuhart
2019-08-27 09:08:00 +02:00
parent 30eb48321c
commit 8415bee5da
2 changed files with 46 additions and 7 deletions

View File

@@ -88,7 +88,7 @@ func (p officePrinter) Print(destination string) error {
}
// nolint: gochecknoglobals
var lock = make(chan struct{}, 1)
var lockUnoconv = make(chan struct{}, 1)
func unoconv(ctx context.Context, logger xlog.Logger, fpath, destination string, opts OfficePrinterOptions) error {
const op string = "printer.unoconv"
@@ -115,14 +115,14 @@ func unoconv(ctx context.Context, logger xlog.Logger, fpath, destination string,
}
logger.DebugOp(op, "waiting lock to be acquired...")
select {
case lock <- struct{}{}:
case lockUnoconv <- struct{}{}:
// lock acquired.
logger.DebugOp(op, "lock acquired")
if err := resolver(); err != nil {
<-lock // we release the lock.
<-lockUnoconv // we release the lock.
return xerror.New(op, err)
}
<-lock // we release the lock.
<-lockUnoconv // we release the lock.
return nil
case <-ctx.Done():
// failed to acquire lock before