Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Warm up ConCache before tests (#4587)

hq1f645a9ba1d1b
diff --git a/test/test_helper.exs b/test/test_helper.exs
index 28b49029a3..c9006141c2 100644
--- a/test/test_helper.exs
+++ b/test/test_helper.exs
@@ -22,6 +22,18 @@ end
default_exclude = [:slow, :minio, :migrations]
+# warm up ConCache until https://github.com/sasa1977/con_cache/pull/79
+:code.ensure_loaded(ConCache.Lock.Resource)
+
+for i <- 1..(System.schedulers_online() * 2) do
+ Plausible.Cache.Adapter.with_lock(
+ :sessions,
+ {i, i + 1},
+ 500,
+ fn -> :warmup end
+ )
+end
+
if Mix.env() == :ce_test do
IO.puts("Test mode: Community Edition")
ExUnit.configure(exclude: [:ee_only | default_exclude])