Skip to content

Commit a7026c5

Browse files
committed
tweak: first data fetch will happen immediately after run
1 parent a26040e commit a7026c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
var (
18-
version = "0.1.0"
18+
version = "0.1.1"
1919
debug bool
2020
)
2121

@@ -27,11 +27,13 @@ type PriceData struct {
2727
type Response []PriceData
2828

2929
func doEvery(d time.Duration, f func(time.Time)) {
30+
f(time.Now()) // Execute immediately
3031
for x := range time.Tick(d) {
3132
f(x)
3233
}
3334
}
3435

36+
3537
func pushToInflux(t time.Time) {
3638
priceArea := os.Getenv("PRICE_AREA")
3739
if priceArea == "" {

0 commit comments

Comments
 (0)