Skip to content

Commit

Permalink
Remove testing mode code.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhowse committed Aug 11, 2024
1 parent 86f7499 commit bfdf1b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
woolworths "github.com/tjhowse/aus_grocery_price_database/internal/woolworths"
)

const VERSION = "0.0.30"
const VERSION = "0.0.31"
const SYSTEM_STATUS_UPDATE_INTERVAL_SECONDS = 60

type config struct {
Expand Down Expand Up @@ -108,13 +108,13 @@ func run(running *bool, cfg *config, tsDB timeseriesDB, w ProductInfoGetter) {
continue
}
slog.Info("Updating product data", "id", newProductInfo.ID, "name", newProductInfo.Name, "price", newProductInfo.PriceCents)
// productInfoUpdateChannel <- newProductInfo
productInfoUpdateChannel <- newProductInfo
}

updateCountSinceLastStatusReport += len(woolworthsProducts)

// Send a system status update if required.
if time.Now().After(statusReportDeadline) && false {
if time.Now().After(statusReportDeadline) {
systemStatus.ProductsPerSecond = float64(updateCountSinceLastStatusReport) / SYSTEM_STATUS_UPDATE_INTERVAL_SECONDS
updateCountSinceLastStatusReport = 0

Expand Down
4 changes: 4 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ func TestRun(t *testing.T) {
t.Fatalf("Expected %d items, got %d", want, got)
}

if len(mockInfluxDB.writtenSystemDatapoints) == 0 {
t.Fatal("Expected a system datapoint to be written")
}

if want, got := 100, mockInfluxDB.writtenSystemDatapoints[0].TotalProductCount; want != got {
t.Errorf("Expected %v, got %v", want, got)
}
Expand Down

0 comments on commit bfdf1b8

Please sign in to comment.