I’m trying to use
FunWithFlags.enabled? (ref fwf) inside an absinthe middleware but I got the following error:
(ArgumentError) argument error (stdlib) :ets.lookup(:fun_with_flags_cache, :some_flag) Stacktrace: │ lib/fun_with_flags/store/cache.ex:35: FunWithFlags.Store.Cache.get/1 │ lib/fun_with_flags/store.ex:12: FunWithFlags.Store.lookup/1 │ lib/fun_with_flags.ex:77: FunWithFlags.enabled?/2
I haven’t tried too much. I just narrowed down where the issue is happening. I’m guessing that the middleware compiles before the
:some_flag record (or maybe the
:fun_with_flags_cache table) is created and then failed because there is no record/table.
This link says:
It stores flag information in Redis or a relational DB (PostgreSQL or MySQL, with Ecto) for persistence and synchronization across different nodes, but it also maintains a local cache in an ETS table for fast lookups. When flags are added or toggled on a node, the other nodes are notified via PubSub and reload their local ETS caches
So I’m guessing one option could be disable the ETS with the following config:
config :fun_with_flags, :cache, enabled: false, ttl: 900
But we lost all of the benefits of the cache.
Anyway, Any thought are welcome. Thanks in advance.
Note: It doesn’t work adding the config.