diff options
Diffstat (limited to 'status/00-status.go')
| -rw-r--r-- | status/00-status.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/status/00-status.go b/status/00-status.go index dadc668..ca8282c 100644 --- a/status/00-status.go +++ b/status/00-status.go @@ -41,7 +41,7 @@ func init() { }() } -func register(name string, fn func(string) error) { +func register(name string, fn func(*Block) error, seconds int) { nid := 0 for _, id := range blockid { if id >= nid { @@ -53,22 +53,24 @@ func register(name string, fn func(string) error) { go func(){ for { - err := fn(name) + u := newBlock(name) + err := fn(u) if err != nil { common.Error("block \"%s\": %s\n", name, err) - u := newUpdate(name) u.drawText(0, config.Red, fmt.Sprintf("[err: %s]", name)) updates <- u - sleep(5) + } else { + updates <- u + sleep(seconds) } } }() } -func newUpdate(name string) (*Block) { +func newBlock(name string) (*Block) { var s Block s.Name = name |