mathieuprog / tz

Time zone support for Elixir
Apache License 2.0
147 stars 11 forks source link

Error with Iana version 2023a #16

Closed pggalaviz closed 1 year ago

pggalaviz commented 1 year ago

When downloading version 2023a of database and compiling, an error is raised:

** (EXIT) an exception was raised:
        ** (RuntimeError) unexpected case: 3 ongoing rules for rule "Palestine"
            (tz 0.24.0) lib/tz/compiler.ex:25: anonymous fn/1 in Tz.Compiler.compile/0
            (elixir 1.14.1) lib/enum.ex:980: anonymous fn/3 in Enum.each/2
            (stdlib 4.1.1) maps.erl:411: :maps.fold_1/3
            (elixir 1.14.1) lib/enum.ex:2480: Enum.each/2
            (tz 0.24.0) lib/tz/compiler.ex:22: anonymous fn/3 in Tz.Compiler.compile/0
            (elixir 1.14.1) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
            (tz 0.24.0) lib/tz/compiler.ex:18: Tz.Compiler.compile/0
            (tz 0.24.0) lib/tz/updater.ex:21: Tz.Updater.maybe_recompile/0
            (tz 0.24.0) lib/tz/update_periodically.ex:26: Tz.UpdatePeriodically.init/1
            (stdlib 4.1.1) gen_server.erl:851: :gen_server.init_it/2
            (stdlib 4.1.1) gen_server.erl:814: :gen_server.init_it/6
            (stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
mathieuprog commented 1 year ago

Interesting! I'll be on this asap

shawnleong commented 1 year ago

@mathieuprog I'm getting a similar issue too.

%RuntimeError{message: "unexpected case: 3 ongoing rules for rule \"Palestine\""}

~Are there any workarounds you would suggest at the moment?~ ~* Perhaps revert to an older version of the timezone via a manual mix tz command?~

Update: This is my workraound. Remove/comment out any lines in application.ex that have to do with periodically updating with the latest IANA should revert back to the precompiled version stated in this repo (2022f) rather than the latest IANA tzdb (2023a).

# |> append_if(Application.get_env(:my_app, :env) != :test, {Tz.UpdatePeriodically, []})
mathieuprog commented 1 year ago

It's being worked on now. Be back with updates.

mathieuprog commented 1 year ago

@pggalaviz @shawnleong could you try 0.25 🙏?

shawnleong commented 1 year ago

@mathieuprog Thanks! :pray:

Just tried 0.25. Seems to work just fine based on the logs. I don't see the %RuntimeError{} anymore :+1:

[info]16:35:48.485 [info] Latest version of the IANA time zone data is 2023a module=Tz.Updater function=fetch_latest_iana_tz_version/0 line=59