Browse Source

Make deployer keep listening...

master
Chris Smith 5 years ago
parent
commit
35baa44c5d
1 changed files with 14 additions and 10 deletions
  1. 14
    10
      certs/deployer.go

+ 14
- 10
certs/deployer.go View File

@@ -34,20 +34,24 @@ func NewCertificateDeployer(logger *zap.SugaredLogger, channel <-chan model.Foun
34 34
 }
35 35
 
36 36
 func (c *CertificateDeployer) monitor() {
37
-	select {
38
-	case cert := <-c.certChannel:
39
-		c.certs[cert.Hostname] = cert
40
-		c.deployChannel <- true
37
+	for {
38
+		select {
39
+		case cert := <-c.certChannel:
40
+			c.certs[cert.Hostname] = cert
41
+			c.deployChannel <- true
42
+		}
41 43
 	}
42 44
 }
43 45
 
44 46
 func (c *CertificateDeployer) deployAll() {
45
-	select {
46
-	case <-c.deployChannel:
47
-		c.logger.Debug("Checking for certificates requiring deployment")
48
-		for _, hostname := range c.hostnames {
49
-			if cert, ok := c.certs[hostname.Name]; ok {
50
-				c.deploySingle(cert, hostname)
47
+	for {
48
+		select {
49
+		case <-c.deployChannel:
50
+			c.logger.Debug("Checking for certificates requiring deployment")
51
+			for _, hostname := range c.hostnames {
52
+				if cert, ok := c.certs[hostname.Name]; ok {
53
+					c.deploySingle(cert, hostname)
54
+				}
51 55
 			}
52 56
 		}
53 57
 	}

Loading…
Cancel
Save