Skip to content

Commit

Permalink
ceb: restore data staleness check
Browse files Browse the repository at this point in the history
  • Loading branch information
hg committed Jun 11, 2021
1 parent 0e3e958 commit 3a53e79
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gateway/ceb/ceb.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ func (s *staleDetector) isStale(station string, pollutant string, level float64)
s.values[key] = rep
}

if rep.level == level {
// SO2 levels often exceed 750 ug/m3, but are capped by
// this value due to some limitation in the data provider.
// So 750 ug/m3 may be reported for many consecutive hours.
// This doesn't mean that the data is invalid.
// TODO: add ceiling checks for other pollutants
if rep.level == level && (pollutant != "SO2" || level != 750) {
if rep.count >= staleMaxUpdates {
return true
}
Expand Down

0 comments on commit 3a53e79

Please sign in to comment.