From 79cb745a5dea38456475911cf7edaab94d710ac2 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Tue, 27 Oct 2015 19:54:08 +0300 Subject: [PATCH] Define an empty Shutdown function on base daemon --- daemon.go | 2 ++ example/daemons/number_printer.go | 3 --- example/daemons/price_consumer.go | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/daemon.go b/daemon.go index ab6f747..972b53d 100644 --- a/daemon.go +++ b/daemon.go @@ -164,6 +164,8 @@ func (d *BaseDaemon) Logf(format string, v ...interface{}) { d.logger.Printf(format, v...) } +func (d *BaseDaemon) Shutdown() {} + // String returns the name of the Deamon unerlying struct. func (d *BaseDaemon) String() string { if d.name == "" { diff --git a/example/daemons/number_printer.go b/example/daemons/number_printer.go index be0ae63..3a03d7e 100644 --- a/example/daemons/number_printer.go +++ b/example/daemons/number_printer.go @@ -22,9 +22,6 @@ func (n *NumberPrinter) Startup() { n.SystemProcess("Random Number Generator", n.generateNumbers) } -// Shutdown is empty due to the lack of cleanup. -func (n *NumberPrinter) Shutdown() {} - func (n *NumberPrinter) generateNumbers() { for n.Continue() { if rand.Intn(10) == 0 { diff --git a/example/daemons/price_consumer.go b/example/daemons/price_consumer.go index f67883d..8f20228 100644 --- a/example/daemons/price_consumer.go +++ b/example/daemons/price_consumer.go @@ -24,6 +24,3 @@ func (p *PriceConsumer) Startup() { }) p.LimitRate(5, time.Second) } - -// Shutdown is empty because PriceConsumer requires no cleanup upon exiting. -func (p *PriceConsumer) Shutdown() {}