From 6a35f122a3702d5920283154c4579003ba9a7d77 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Tue, 29 May 2018 20:33:34 +0430 Subject: [PATCH] add time interval for send http request --- cryptolive/widget.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cryptolive/widget.go b/cryptolive/widget.go index ec6dbea7..09e01985 100644 --- a/cryptolive/widget.go +++ b/cryptolive/widget.go @@ -19,7 +19,8 @@ var started = false type Widget struct { wtf.TextWidget - CurrentIcon int + // time interval for send http request + updateInterval int *list } @@ -28,7 +29,8 @@ type Widget struct { func NewWidget() *Widget { started = false widget := Widget{ - TextWidget: wtf.NewTextWidget(" $ CryptoLive ", "cryptolive", false), + TextWidget: wtf.NewTextWidget(" $ CryptoLive ", "cryptolive", false), + updateInterval: Config.UInt("wtf.mods.cryptolive.updateInterval", 10), } currenciesMap, _ := Config.Map("wtf.mods.cryptolive.currencies") @@ -71,7 +73,7 @@ func (widget *Widget) Refresh() { go func() { for { widget.updateCurrencies() - time.Sleep(time.Duration(widget.RefreshInterval()) * time.Second) + time.Sleep(time.Duration(widget.updateInterval) * time.Second) } }() @@ -127,5 +129,4 @@ func (widget *Widget) updateCurrencies() { } } - }