fix spacing

master
Chakib Benziane 5 years ago
parent 94cb8c3bad
commit 0c65f2c56c

@ -37,24 +37,24 @@ type Worker struct{}
// Example loop, it will be spwaned in a goroutine // Example loop, it will be spwaned in a goroutine
func (w *Worker) Spawn(um UnitManager) { func (w *Worker) Spawn(um UnitManager) {
ticker := time.NewTicker(time.Second) ticker := time.NewTicker(time.Second)
// Worker's loop // Worker's loop
for { for {
select { select {
case <-ticker.C: case <-ticker.C:
log.Println("tick") log.Println("tick")
// Read from channel if this worker unit should stop // Read from channel if this worker unit should stop
case <-um.ShouldStop(): case <-um.ShouldStop():
// Shutdown work for current unit // Shutdown work for current unit
w.Shutdown() w.Shutdown()
// Notify manager that this unit is done. // Notify manager that this unit is done.
um.Done() um.Done()
} }
} }
} }
func (w *Worker) Shutdown() { func (w *Worker) Shutdown() {

Loading…
Cancel
Save