From 94abc75419950b8351c40521a9b15e36d4f1d5db Mon Sep 17 00:00:00 2001 From: Ramez Magdy Date: Thu, 30 Sep 2021 22:37:16 +0200 Subject: [PATCH] fixes #1019 (#1020) this commit fixes #1019 --- builtin/bins/dkron-executor-nats/nats.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builtin/bins/dkron-executor-nats/nats.go b/builtin/bins/dkron-executor-nats/nats.go index e918a0216..844f5eadd 100644 --- a/builtin/bins/dkron-executor-nats/nats.go +++ b/builtin/bins/dkron-executor-nats/nats.go @@ -73,6 +73,11 @@ func (s *Nats) ExecuteImpl(args *dktypes.ExecuteRequest) ([]byte, error) { if debug { log.Printf("request %#v\n\n", nc) } + + if nc.IsConnected() { + defer nc.Flush() + defer nc.Close() + } return output.Bytes(), nil }