GoodAnalytics.Geo.Loader (GoodAnalytics v0.1.1)

Copy Markdown View Source

Starts and supervises the configured locus loader.

This module is wired into GoodAnalytics.Application and is a no-op when either :locus is not loaded OR no :provider is configured under :good_analytics, :geo. Startup is non-blocking — a failed fetch logs an error but does not crash the supervisor.

Loader status transitions are emitted at info level. To wait for the loader to become ready in scripts or release tasks, use await/1.

Summary

Functions

Blocks until the loader has fetched and parsed the MMDB. Useful in release tasks or scripts. Returns :ok or {:error, reason}.

Starts the configured loader, if any. Always returns :ignore so the supervisor treats it as a no-op child after startup; the loader itself runs inside the locus application supervisor.

Called by the supervisor at boot. Always returns :ignore — the locus loader runs inside the locus application's own supervision tree. Errors are logged but not propagated to our supervisor; they will not be observable via supervisor status. Use await/1 from a release task to surface them.

Functions

await(timeout \\ 30000)

@spec await(timeout()) :: :ok | {:error, term()}

Blocks until the loader has fetched and parsed the MMDB. Useful in release tasks or scripts. Returns :ok or {:error, reason}.

child_spec(opts)

Starts the configured loader, if any. Always returns :ignore so the supervisor treats it as a no-op child after startup; the loader itself runs inside the locus application supervisor.

start_link()

Called by the supervisor at boot. Always returns :ignore — the locus loader runs inside the locus application's own supervision tree. Errors are logged but not propagated to our supervisor; they will not be observable via supervisor status. Use await/1 from a release task to surface them.