Improve Daemon interface description
This commit is contained in:
		
							parent
							
								
									c740f13063
								
							
						
					
					
						commit
						98bbbf91f4
					
				
							
								
								
									
										14
									
								
								daemon.go
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								daemon.go
									
									
									
									
									
								
							| @ -11,23 +11,23 @@ import ( | |||||||
| // Daemon is the interface that contains a set of methods required to be | // Daemon is the interface that contains a set of methods required to be | ||||||
| // implemented in order to be treated as a daemon. | // implemented in order to be treated as a daemon. | ||||||
| type Daemon interface { | type Daemon interface { | ||||||
| 	// Startup implementation should... | 	// Startup implementation should: | ||||||
| 	// | 	// | ||||||
| 	// func (d *DaemonName) Startup() { | 	// func (d *DaemonName) Startup() { | ||||||
| 	//     // Set up a panic handler: | 	//     // 1. Set up a panic handler | ||||||
| 	//     b.HandlePanics(func() { | 	//     b.HandlePanics(func() { | ||||||
| 	//         log.Error("Oh, crap!") | 	//         log.Error("Oh, crap!") | ||||||
| 	//     }) | 	//     }) | ||||||
| 	// | 	// | ||||||
| 	//     // If the daemon is also a consumer we need to subscribe for topics | 	//     // 2. If the daemon is also a consumer we need to subscribe for | ||||||
| 	//     // that would be consumed by the daemon. | 	//     // topics that would be consumed by the daemon | ||||||
| 	//     b.Subscribe("ProductPriceUpdates", func(p PriceUpdate) { | 	//     b.Subscribe("ProductPriceUpdates", func(p PriceUpdate) { | ||||||
| 	// 	       log.Printf("Price for %q is now $%.2f", p.Product, p.Amount) | 	// 	       log.Printf("Price for %q is now $%.2f", p.Product, p.Amount) | ||||||
| 	//     }) | 	//     }) | ||||||
| 	// | 	// | ||||||
| 	//     // If the daemon is doing some IO it is a good idea to limit the rate | 	//     // 3. If the daemon is doing some IO it is a good idea to limit the | ||||||
| 	//     // of its execution. | 	//     // rate of its execution | ||||||
| 	//     b.SetRateLimit(10, 1 * time.Second) | 	//     b.LimitRate(10, 1 * time.Second) | ||||||
| 	// } | 	// } | ||||||
| 	Startup() | 	Startup() | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user