Skip to content

Commit 21a4762

Browse files
committed
gasstations: only store blocks on price changes
1 parent f73ecf0 commit 21a4762

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/datasources/gasstations/blocks.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ func NewGasStationBlockWithSource(
7575
"source": source,
7676
}
7777

78-
blockID := fmt.Sprintf("gasstation-%s-%d", stationID, createdAt.Unix())
78+
// Use content-based ID so we only create new blocks when prices change
79+
// This prevents storing duplicate data when prices remain the same
80+
blockID := fmt.Sprintf("gasstation-%s-%s-%s-%s-%s", stationID, gasoline95, diesel, gasoline98, biodiesel)
7981

8082
return &GasStationBlock{
8183
id: blockID,

0 commit comments

Comments
 (0)