Language
This commit is contained in:
parent
3937c71a42
commit
0e1fbbe729
@ -89,7 +89,7 @@ func (d *BaseDaemon) SystemProcess(name string, a Actor) {
|
|||||||
|
|
||||||
// Subscribe subscriasdsdfsdgdfgdfsg sdgsdfg sdfgs dfgdfgdfg.
|
// Subscribe subscriasdsdfsdgdfgdfsg sdgsdfg sdfgs dfgdfgdfg.
|
||||||
func (d *BaseDaemon) Subscribe(topic string, fun interface{}) {
|
func (d *BaseDaemon) Subscribe(topic string, fun interface{}) {
|
||||||
name := fmt.Sprintf("Subscription for topic %q", topic)
|
name := fmt.Sprintf("subscription for topic %q", topic)
|
||||||
d.SystemProcess(name, func() {
|
d.SystemProcess(name, func() {
|
||||||
if d.subscribeFunc == nil {
|
if d.subscribeFunc == nil {
|
||||||
panic(errMissingSubscriptionFun)
|
panic(errMissingSubscriptionFun)
|
||||||
|
@ -19,7 +19,7 @@ func (n *NumberPrinter) Startup() {
|
|||||||
log.Printf("Oh, crap! There was a panic, take a look: %v", err)
|
log.Printf("Oh, crap! There was a panic, take a look: %v", err)
|
||||||
})
|
})
|
||||||
|
|
||||||
n.LimitRate(3, 1*time.Second)
|
n.LimitRate(3, time.Second)
|
||||||
n.SystemProcess("Random Number Generator", n.generateNumbers)
|
n.SystemProcess("Random Number Generator", n.generateNumbers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ func (p *PriceConsumer) Startup() {
|
|||||||
b.Subscribe("ProductPriceUpdates", func(u PriceUpdate) {
|
b.Subscribe("ProductPriceUpdates", func(u PriceUpdate) {
|
||||||
log.Printf("Price for %q is now $%.2f", u.Product, u.Amount)
|
log.Printf("Price for %q is now $%.2f", u.Product, u.Amount)
|
||||||
})
|
})
|
||||||
p.LimitRate(5, 1*time.Second)
|
p.LimitRate(5, time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown is empty because PriceConsumer requires no cleanup upon exiting.
|
// Shutdown is empty because PriceConsumer requires no cleanup upon exiting.
|
||||||
|
4
satan.go
4
satan.go
@ -162,7 +162,7 @@ func (s *Satan) processSystemTask(t *task) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
log.Printf("Starting system task %s\n", t)
|
log.Printf("Starting system task %s\n", t)
|
||||||
t.actor() // <--- THE ACTION HAPPENS HERE
|
t.actor() // <--- ACTION STARTS HERE
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Satan) processGeneralTask(t *task) {
|
func (s *Satan) processGeneralTask(t *task) {
|
||||||
@ -183,7 +183,7 @@ func (s *Satan) processGeneralTask(t *task) {
|
|||||||
}(time.Now())
|
}(time.Now())
|
||||||
}
|
}
|
||||||
|
|
||||||
t.actor() // <--- THE ACTION HAPPENS HERE
|
t.actor() // <--- ACTION STARTS HERE
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *task) String() string {
|
func (t *task) String() string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user