mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Faster start by having async initial refresh
This commit is contained in:
parent
f1590e29f8
commit
1404140b82
11
wtf.go
11
wtf.go
@ -41,52 +41,43 @@ func main() {
|
|||||||
|
|
||||||
bamboohr.Config = Config
|
bamboohr.Config = Config
|
||||||
bamboo := bamboohr.NewWidget()
|
bamboo := bamboohr.NewWidget()
|
||||||
bamboo.Refresh()
|
|
||||||
go wtf.Schedule(bamboo)
|
go wtf.Schedule(bamboo)
|
||||||
|
|
||||||
gcal.Config = Config
|
gcal.Config = Config
|
||||||
cal := gcal.NewWidget()
|
cal := gcal.NewWidget()
|
||||||
cal.Refresh()
|
|
||||||
go wtf.Schedule(cal)
|
go wtf.Schedule(cal)
|
||||||
|
|
||||||
git.Config = Config
|
git.Config = Config
|
||||||
git := git.NewWidget()
|
git := git.NewWidget()
|
||||||
git.Refresh()
|
|
||||||
go wtf.Schedule(git)
|
go wtf.Schedule(git)
|
||||||
|
|
||||||
github.Config = Config
|
github.Config = Config
|
||||||
github := github.NewWidget()
|
github := github.NewWidget()
|
||||||
github.Refresh()
|
|
||||||
go wtf.Schedule(github)
|
go wtf.Schedule(github)
|
||||||
|
|
||||||
jira.Config = Config
|
jira.Config = Config
|
||||||
jira := jira.NewWidget()
|
jira := jira.NewWidget()
|
||||||
jira.Refresh()
|
|
||||||
go wtf.Schedule(jira)
|
go wtf.Schedule(jira)
|
||||||
|
|
||||||
newrelic.Config = Config
|
newrelic.Config = Config
|
||||||
newrelic := newrelic.NewWidget()
|
newrelic := newrelic.NewWidget()
|
||||||
newrelic.Refresh()
|
|
||||||
go wtf.Schedule(newrelic)
|
go wtf.Schedule(newrelic)
|
||||||
|
|
||||||
opsgenie.Config = Config
|
opsgenie.Config = Config
|
||||||
opsgenie := opsgenie.NewWidget()
|
opsgenie := opsgenie.NewWidget()
|
||||||
opsgenie.Refresh()
|
|
||||||
go wtf.Schedule(opsgenie)
|
go wtf.Schedule(opsgenie)
|
||||||
|
|
||||||
security.Config = Config
|
security.Config = Config
|
||||||
sec := security.NewWidget()
|
sec := security.NewWidget()
|
||||||
sec.Refresh()
|
|
||||||
go wtf.Schedule(sec)
|
go wtf.Schedule(sec)
|
||||||
|
|
||||||
status.Config = Config
|
status.Config = Config
|
||||||
stat := status.NewWidget()
|
stat := status.NewWidget()
|
||||||
stat.Refresh()
|
|
||||||
go wtf.Schedule(stat)
|
go wtf.Schedule(stat)
|
||||||
|
|
||||||
weather.Config = Config
|
weather.Config = Config
|
||||||
weather := weather.NewWidget()
|
weather := weather.NewWidget()
|
||||||
weather.Refresh()
|
go wtf.Schedule(weather)
|
||||||
|
|
||||||
grid := tview.NewGrid()
|
grid := tview.NewGrid()
|
||||||
grid.SetRows(10, 10, 10, 10, 10, 4) // How _high_ the row is, in terminal rows
|
grid.SetRows(10, 10, 10, 10, 10, 4) // How _high_ the row is, in terminal rows
|
||||||
|
@ -13,6 +13,9 @@ func Schedule(widget Scheduler) {
|
|||||||
tick := time.NewTicker(time.Duration(widget.RefreshInterval()) * time.Second)
|
tick := time.NewTicker(time.Duration(widget.RefreshInterval()) * time.Second)
|
||||||
quit := make(chan struct{})
|
quit := make(chan struct{})
|
||||||
|
|
||||||
|
// Kick off the first refresh and then leave the rest to the timer
|
||||||
|
widget.Refresh()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-tick.C:
|
case <-tick.C:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user