mirror of
https://github.com/plausible/analytics.git
synced 2024-12-25 02:24:55 +03:00
ee3d1e770e
* Add data migration for creating and syncing location_data table and dictionary * Migration to populate location data * Daily cron to refresh location dataset if changed * Add support for visit:country_name, visit:region_name and visit:city_name dimensions Under the hood this relies on a `location_data` table in clickhouse being regularly synced with plausible/location repo and dictionary lookups used in ALIAS columns * Update queue name * Update documentation * Explicit structs * Improve docs further * Migration comment * Add queues * Add error when already loaded * Test for filtering by new dimensions * Update deps * dimension -> select_dimension * Update a test
16 lines
312 B
Elixir
16 lines
312 B
Elixir
defmodule Plausible.Workers.LocationsSync do
|
|
@moduledoc false
|
|
|
|
use Plausible.Repo
|
|
use Oban.Worker, queue: :locations_sync
|
|
|
|
@impl Oban.Worker
|
|
def perform(_job) do
|
|
if Plausible.DataMigration.LocationsSync.out_of_date?() do
|
|
Plausible.DataMigration.LocationsSync.run()
|
|
end
|
|
|
|
:ok
|
|
end
|
|
end
|