diff --git a/server/backend/ingestion_received_handler.go b/server/backend/ingestion_received_handler.go index 99c2772e5..c46e967e9 100644 --- a/server/backend/ingestion_received_handler.go +++ b/server/backend/ingestion_received_handler.go @@ -91,9 +91,17 @@ func (h *IngestionReceivedHandler) Handle(ctx context.Context, m *messages.Inges } if info.StationID != nil { + now := time.Now() + howFarBack := time.Hour * 48 + if now.After(info.DataStart) { + howFarBack += now.Sub(info.DataStart) + log.Infow("refreshing", "how_far_back", howFarBack) + } else { + log.Warnw("data-after-now", "data_start", info.DataStart, "data_end", info.DataEnd, "now", now) + } if err := h.publisher.Publish(ctx, &messages.RefreshStation{ StationID: *info.StationID, - HowRecently: time.Hour * 48, + HowRecently: howFarBack, Completely: false, UserID: i.UserID, }); err != nil { diff --git a/server/backend/record_adder.go b/server/backend/record_adder.go index a927dd394..03987350c 100644 --- a/server/backend/record_adder.go +++ b/server/backend/record_adder.go @@ -144,6 +144,8 @@ type WriteInfo struct { MetaErrors int64 DataErrors int64 StationID *int32 + DataStart time.Time + DataEnd time.Time } func (ra *RecordAdder) fixDataRecord(ctx context.Context, record *pb.DataRecord) (bool, error) { @@ -307,6 +309,8 @@ func (ra *RecordAdder) WriteRecords(ctx context.Context, i *data.Ingestion) (inf MetaErrors: int64(metaErrors), DataErrors: int64(dataErrors), StationID: stationID, + DataStart: ra.statistics.start, + DataEnd: ra.statistics.end, } return