2
0
Эх сурвалжийг харах

Merge pull request #446 from kubecost/AjayTripathy-refresh

add refresh
Ajay Tripathy 6 жил өмнө
parent
commit
200ab49f68

+ 4 - 0
pkg/cloud/csvprovider.go

@@ -7,6 +7,7 @@ import (
 	"os"
 	"strings"
 	"sync"
+	"time"
 
 	"github.com/aws/aws-sdk-go/aws"
 	"github.com/aws/aws-sdk-go/aws/session"
@@ -17,6 +18,8 @@ import (
 	"github.com/jszwec/csvutil"
 )
 
+const refreshMinutes = 60
+
 type CSVProvider struct {
 	*CustomProvider
 	CSVLocation             string
@@ -129,6 +132,7 @@ func (c *CSVProvider) DownloadPricingData() error {
 	} else {
 		klog.Infof("[WARNING] No data received from csv")
 	}
+	time.AfterFunc(refreshMinutes*time.Minute, func() { c.DownloadPricingData() })
 	return nil
 }