I am trying to make a one time verification call to a webservice (document database api) while expanding a macro. The use case is to define a ‘collection’ for a document module, and this collection would have to be instantiated once when it doesn’t exist. The alternative would be to do this on each subsequent function call, which would be an unnecessary performance hit.
However, I have come to understand the application isn’t fully started yet when the macro is being expanded, so the call inside my defmacro
stumbles on a
** (EXIT) no process
error from httpoison/hackney.
So my question is: what would be the preferred way of doing this? I am guessing I should be using module attributes, but I am not fully up to speed on them. Or is there another way of controlling this?