WIP: temporary decisions for public api #1
							
								
								
									
										8
									
								
								build.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								build.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | //go:generate go build -o watchdog cmd/watchdog/watchdog.go | ||||||
|  | 
 | ||||||
|  | package watchdog | ||||||
|  | 
 | ||||||
|  | // This is takes the place of a makefile. | ||||||
|  | 
 | ||||||
|  | // Usage: | ||||||
|  | // go generate -mod=vendor build.go | ||||||
							
								
								
									
										10
									
								
								watchdog.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								watchdog.go
									
									
									
									
									
								
							| @ -52,6 +52,15 @@ func (d *Dog) watch() { | |||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	time.Sleep(time.Duration(2) * time.Second) | ||||||
|  | 	err2 := d.check() | ||||||
|  | 	if nil != err { | ||||||
|  | 		d.Logger <- fmt.Sprintf("Down: '%s': %s", d.Name, err2) | ||||||
|  | 	} else { | ||||||
|  | 		d.Logger <- fmt.Sprintf("Hiccup: '%s': %s", d.Name, err) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	failure := false | 	failure := false | ||||||
| 	t := 10 | 	t := 10 | ||||||
| 	for { | 	for { | ||||||
| @ -61,6 +70,7 @@ func (d *Dog) watch() { | |||||||
| 		t *= 2 | 		t *= 2 | ||||||
| 		err := d.check() | 		err := d.check() | ||||||
| 		if nil != err { | 		if nil != err { | ||||||
|  | 			d.Logger <- fmt.Sprintf("Unrecoverable: '%s': %s", d.Name, err) | ||||||
| 			failure = true | 			failure = true | ||||||
| 		} else { | 		} else { | ||||||
| 			failure = false | 			failure = false | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user