Use System.os_time/0 for ordering file systems

This commit is contained in:
Jonatan Kłosko 2022-02-22 23:09:54 +01:00
parent 4fcdeb6bcf
commit 4f61639fba

View file

@ -32,7 +32,7 @@ defmodule Livebook.Settings do
def file_systems() do
restored_file_systems =
storage().all(:filesystem)
|> Enum.sort_by(&Map.get(&1, :order, System.monotonic_time()))
|> Enum.sort_by(&Map.get(&1, :order, System.os_time()))
|> Enum.map(fn %{id: fs_id} = raw_fs ->
{fs_id, storage_to_fs(raw_fs)}
end)
@ -53,10 +53,7 @@ defmodule Livebook.Settings do
id = Livebook.Utils.random_short_id()
:ok =
storage().insert(:filesystem, id, [
{:type, "s3"},
{:order, System.monotonic_time()} | attributes
])
storage().insert(:filesystem, id, [{:type, "s3"}, {:order, System.os_time()} | attributes])
id
end