From 1f68e44ce78da986b48ba4ca339058bc0ac3b13b Mon Sep 17 00:00:00 2001 From: John Eikenberry Date: Mon, 9 Jan 2023 15:07:55 -0800 Subject: [PATCH 1/5] unmaintained badge --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a883134df..38daf4ea4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ + +--- # Consul Template +[![Project unmaintained](https://img.shields.io/badge/project-unmaintained-red.svg)](https://github.com/hashicorp/consul-template/issues/1698) [![build](https://github.com/hashicorp/consul-template/actions/workflows/build.yml/badge.svg)](https://github.com/hashicorp/consul-template/actions/workflows/build.yml) [![ci](https://github.com/hashicorp/consul-template/actions/workflows/ci.yml/badge.svg)](https://github.com/hashicorp/consul-template/actions/workflows/ci.yml) [![Go Documentation](http://img.shields.io/badge/go-documentation-%2300acd7)](https://godoc.org/github.com/hashicorp/consul-template) From ec21ccc8d5323e8c50b78703e8667ed37be1a1d4 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Tue, 10 Jan 2023 13:06:38 +0000 Subject: [PATCH 2/5] Fix typo in docs for md5sum example --- docs/templating-language.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/templating-language.md b/docs/templating-language.md index a4a0adcf9..960013832 100644 --- a/docs/templating-language.md +++ b/docs/templating-language.md @@ -1483,7 +1483,7 @@ Takes the argument as a string and compute the sha256_hex value Takes a string input as an argument, and returns the hex-encoded md5 hash of the input. ```golang -{{ "myString" | md5 }} +{{ "myString" | md5sum }} ``` ### `split` From e04ca78a334bb5f129cac46326458404d8a968c3 Mon Sep 17 00:00:00 2001 From: John Eikenberry Date: Tue, 10 Jan 2023 13:37:46 -0800 Subject: [PATCH 3/5] we're trying to figure out a maintanence story... stay tuned --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 38daf4ea4..ea10c82ed 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ --- # Consul Template -[![Project unmaintained](https://img.shields.io/badge/project-unmaintained-red.svg)](https://github.com/hashicorp/consul-template/issues/1698) [![build](https://github.com/hashicorp/consul-template/actions/workflows/build.yml/badge.svg)](https://github.com/hashicorp/consul-template/actions/workflows/build.yml) [![ci](https://github.com/hashicorp/consul-template/actions/workflows/ci.yml/badge.svg)](https://github.com/hashicorp/consul-template/actions/workflows/ci.yml) [![Go Documentation](http://img.shields.io/badge/go-documentation-%2300acd7)](https://godoc.org/github.com/hashicorp/consul-template) From bab3c6e3829a19dc81a497af934712e6b8b367d9 Mon Sep 17 00:00:00 2001 From: Kiril Angov Date: Fri, 3 Feb 2023 16:34:38 -0500 Subject: [PATCH 4/5] Implemente reload signal debouncing --- child/child.go | 13 ++++++++++++- cli.go | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/child/child.go b/child/child.go index 5d0cc61f4..1c10db795 100644 --- a/child/child.go +++ b/child/child.go @@ -10,6 +10,7 @@ import ( "os/exec" "strings" "sync" + "sync/atomic" "syscall" "time" @@ -49,6 +50,7 @@ type Child struct { timeout time.Duration reloadSignal os.Signal + reloading uint32 killSignal os.Signal killTimeout time.Duration @@ -396,7 +398,7 @@ func (c *Child) signal(s os.Signal) error { // kill takes negative pid to indicate that you want to use gpid pid = -(pid) } - // cross platform way to signal process/process group + // cross-platform way to signal process/process group if p, err := os.FindProcess(pid); err != nil { return err } else { @@ -405,6 +407,15 @@ func (c *Child) signal(s os.Signal) error { } func (c *Child) reload() error { + if !atomic.CompareAndSwapUint32(&c.reloading, 0, 1) { + c.logger.Printf("[INFO] (child) reload already in progress") + return nil + } + defer func() { + c.logger.Printf("[INFO] (child) reload completed") + atomic.StoreUint32(&c.reloading, 0) + }() + select { case <-c.stopCh: case <-c.randomSplay(): diff --git a/cli.go b/cli.go index 4d64ce0b2..6fb8031f6 100644 --- a/cli.go +++ b/cli.go @@ -167,7 +167,7 @@ func (cli *CLI) Run(args []string) int { return ExitCodeInterrupt default: // Propagate the signal to the child process - runner.Signal(s) + go runner.Signal(s) } case <-cli.stopCh: return ExitCodeOK @@ -175,7 +175,7 @@ func (cli *CLI) Run(args []string) int { } } -// stop is used internally to shutdown a running CLI +// stop is used internally to shut down a running CLI func (cli *CLI) stop() { cli.Lock() defer cli.Unlock() From 0bb3f27f3b6ce93c750ecfbfb48476317ae33e88 Mon Sep 17 00:00:00 2001 From: Kiril Angov Date: Mon, 29 Jan 2024 21:05:22 -0500 Subject: [PATCH 5/5] --amend --- child/child.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/child/child.go b/child/child.go index 1c10db795..cf02953a5 100644 --- a/child/child.go +++ b/child/child.go @@ -487,8 +487,9 @@ func (c *Child) randomSplay() <-chan time.Time { return time.After(0) } - ns := c.splay.Nanoseconds() - offset := rand.Int63n(ns) + max := c.splay.Nanoseconds() + min := c.splay.Nanoseconds() / 2 + offset := rand.Int63n(max-min+1) + min t := time.Duration(offset) c.logger.Printf("[DEBUG] (child) waiting %.2fs for random splay", t.Seconds())