package.elm-lang.org
package.elm-lang.org copied to clipboard
Data loss on reboot if two packages were ever published the same second
trafficstars
Problem sequence
- Two packages are published the same second.
- Timestamps get
floored to a one-second resolution inReleases.hs:
encode :: [Release] -> Encode.Value
encode releases =
Encode.object $ flip map (List.sort releases) $ \(Release version time) ->
( Pkg.versionToText version, Encode.int (floor time) )
- The server reboots and loads
History.Historyfrom disk, sortingEvents by time by putting package versions into this dict:
type TimeDict =
Map.Map Time.NominalDiffTime (Pkg.Name, Pkg.Version)
which will drop packages with the same Time.NominalDiffTime.
Suggested fix:
Don't floor timestamps. We probably won't see two packages published the same 10^-12 s timestamp.