whitfin / cachex

A powerful caching library for Elixir with support for transactions, fallbacks and expirations
https://hexdocs.pm/cachex/
MIT License
1.6k stars 103 forks source link

Correctly terminate distributed caches #321

Closed whitfin closed 10 months ago

whitfin commented 10 months ago

Fixes #318.

Something changed in Elixir v1.15 which started showing many errors. Initially I thought it was some bug in the newer version, but it turns out the older versions were just masking an error in tests. This corrects this issue, which was just leaving some unused services around during tests.

kianmeng commented 10 months ago

@whitfin Thanks for fixing this. I have tested with latest Elixir (1.16.0) and Erlang/OTP (26.2.1) and all tests passed except for some warnings (I filtered out deprecattion warnings):

$ mix test
    warning: TestHelper.delete_on_exit/1 is undefined (module TestHelper is not available or is yet to be defined)
    │
 49 │     TestHelper.delete_on_exit(name)  
    │                ~      
    │
    └─ test/lib/cachex_case/helper.ex:49:16: CachexCase.Helper.create_cache_cluster/2                      
    └─ test/lib/cachex_case/helper.ex:99:20: CachexCase.Helper.delete_on_exit/1                                               

    warning: TestHelper.on_exit/2 is undefined (module TestHelper is not available or is yet to be defined)
    │                                                                                                                                     
 52 │     TestHelper.on_exit("stop #{name} children", fn ->
    │                ~                                               
    │                       
    └─ test/lib/cachex_case/helper.ex:52:16: CachexCase.Helper.create_cache_cluster/2
...
whitfin commented 10 months ago

@kianmeng yeah I don't really know what to do about those; the code exists and is valid (it's loaded later, I guess). So I think this is just a false positive, but I'm not sure how to turn it off