scoutapp / scout_apm_elixir

ScoutAPM Elixir Agent. Supports Phoenix and other frameworks.
https://scoutapm.com
Other
36 stars 20 forks source link

setup cache before starting supervisor #64

Closed johnnyfeng closed 6 years ago

johnnyfeng commented 6 years ago

This fixes an error that pops up when testing apps using this library that happens because ScoutApm.ApplicationLoadNotification tries to access the ets table created by the cache before the table is set up.

[error] GenServer ScoutApm.ApplicationLoadNotification terminating
** (ArgumentError) argument error
    (stdlib) :ets.lookup(:scout_cache, :hostname)
    (scout_apm) lib/scout_apm/cache.ex:15: ScoutApm.Cache.hostname/0
    (scout_apm) lib/scout_apm/payload/app_server_load.ex:16: ScoutApm.Payload.AppServerLoad.new/0
    (scout_apm) lib/scout_apm/application_load_notification.ex:33: ScoutApm.ApplicationLoadNotification.handle_cast/2
    (stdlib) gen_server.erl:616: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:686: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", {:run, [retries: 3]}}
mitchellhenke commented 6 years ago

Thank you! I will push a new release with this patch.