From 8e19a09223672a60aa0f85eb7c0962135e5be7fb Mon Sep 17 00:00:00 2001 From: Axel Gluth Date: Tue, 17 Nov 2020 17:26:01 +0100 Subject: [PATCH] Issue #7: Add retries on busy pipe instances --- npiperelay.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/npiperelay.go b/npiperelay.go index 08cbaab..ce819fc 100644 --- a/npiperelay.go +++ b/npiperelay.go @@ -36,6 +36,13 @@ func dialPipe(p string, poll bool) (*overlappedFile, error) { time.Sleep(200 * time.Millisecond) continue } + if err.Error() == "All pipe instances are busy." { + if *verbose { + log.Printf("All pipe instances are busy. Waiting 200 milliseconds to retry") + } + time.Sleep(200 * time.Millisecond) + continue + } return nil, &os.PathError{Path: p, Op: "open", Err: err} } }