Delay start of Cowboy until Application is ready

Hey there folks,

My team and I noticed that on restarting our release we run in some errors regarding fun-with-flags (fwf).

My first guess is that some part of the fwf application is not quite ready yet, but cowboy already accepts connections. The conn reaches our tracking plug, fwf dies and takes the conn with it.

My first approach would be to delay the start of cowboy until fwf is ready.
I tried this so far by adding image
to the Endpoint module with no eminent effect.

Can anyone of you give me some pointers how to solve this problem?

Kind regards

FunWithFlags does its own supervisor instead of having you add them to your supervisor tree, right? Are you sure its application is starting? If in your mix.exs you use :applications to list applications to start up and :fun_with_flags was not in your list it would not get started up (if you instead use :extra_applications or don’t set either that should be fine).

I’m not sure why it would work fine before a restart, but app startup and supervision tree are usually the first place I check when I have ETS tables that should exist but don’t.

1 Like