Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data loss on reboot if two packages were ever published the same second #322

Open
drathier opened this issue Jan 18, 2020 · 0 comments
Open

Comments

@drathier
Copy link

drathier commented Jan 18, 2020

Problem sequence

  1. Two packages are published the same second.
  2. Timestamps get floored to a one-second resolution in Releases.hs:
encode :: [Release] -> Encode.Value
encode releases =
  Encode.object $ flip map (List.sort releases) $ \(Release version time) ->
    ( Pkg.versionToText version, Encode.int (floor time) )
  1. The server reboots and loads History.History from disk, sorting Events 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant