Add notification about Photon API being under heavy load

This commit is contained in:
Eugene Burmakin 2025-01-04 21:57:24 +01:00
parent 1e9f539dac
commit f366da9df4
5 changed files with 60 additions and 8 deletions

View file

@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
# 0.21.3 - 2025-01-04
### Added
- A notification about Photon API being under heavy load.
### Removed
- The notification about telemetry being enabled.
### Reverted
- ~~Imported points will now be reverse geocoded only after import is finished.~~
# 0.21.2 - 2024-12-25
### Added

View file

@ -2,11 +2,12 @@
class CreateTelemetryNotification < ActiveRecord::Migration[7.2]
def up
User.find_each do |user|
Notifications::Create.new(
user:, kind: :info, title: 'Telemetry enabled', content: notification_content
).call
end
# TODO: Remove
# User.find_each do |user|
# Notifications::Create.new(
# user:, kind: :info, title: 'Telemetry enabled', content: notification_content
# ).call
# end
end
def down

View file

@ -0,0 +1,37 @@
# frozen_string_literal: true
class CreatePhotonLoadNotification < ActiveRecord::Migration[8.0]
def up
User.find_each do |user|
Notifications::Create.new(
user:, kind: :info, title: '⚠️ Photon API is under heavy load', content: notification_content
).call
end
end
def down
raise ActiveRecord::IrreversibleMigration
end
private
def notification_content
<<~CONTENT
<p>
A few days ago <a href="https://github.com/lonvia" class="underline">@lonvia</a>, maintainer of <a href="https://photon.komoot.io" class="underline">https://photon.komoot.io</a>, the reverse-geocoding API service that Dawarich is using by default, <a href="https://github.com/Freika/dawarich/issues/614">reached me</a> to highlight a problem: Dawarich makes too many requests to https://photon.komoot.io, even with recently introduced rate-limiting to prevent more than 1 request per second.
</p>
<br>
<p>
Photon is a great service and Dawarich wouldn't be what it is now without it, but I have to ask all Dawarich users that are running it on their hardware to either switch to a <a href="https://dawarich.app/docs/tutorials/reverse-geocoding#using-photon-api-hosted-by-freika" class="underline">Photon instance</a> hosted by me (<a href="https://github.com/Freika">Freika</a>) or strongly consider hosting their <a href="https://dawarich.app/docs/tutorials/reverse-geocoding#setting-up-your-own-reverse-geocoding-service" class="underline">own Photon instance</a>. Thanks to <a href="https://github.com/rtuszik/photon-docker">@rtuszik</a>, it's pretty much <code>docker compose up -d</code>. The documentation on the website will be soon updated to also encourage setting up your own Photon instance. More reverse geocoding options will be added in the future.</p>
<br>
<p>Let's decrease load on https://photon.komoot.io together!</p>
<br>
<p>Thank you.</p>
CONTENT
end
end

View file

@ -1 +1 @@
DataMigrate::Data.define(version: 20241107112451)
DataMigrate::Data.define(version: 20250104204852)

4
db/schema.rb generated
View file

@ -10,9 +10,9 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2024_12_11_113119) do
ActiveRecord::Schema[8.0].define(version: 2024_12_11_113119) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
enable_extension "pg_catalog.plpgsql"
create_table "action_text_rich_texts", force: :cascade do |t|
t.string "name", null: false