diff --git a/.gitignore b/.gitignore index 71be6ec5..4fe8d20f 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,5 @@ Makefile /db/*.sqlite3 +/db/*.sqlite3-shm +/db/*.sqlite3-wal diff --git a/CHANGELOG.md b/CHANGELOG.md index 13d384f1..00212687 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This release introduces a new way to run background jobs and cache data. Before Moving to SolidQueue and SolidCache will require creating new SQLite databases, which will be created automatically when you start the app. They will be stored in the `dawarich_db_data` volume. +Background jobs interface is now available at `/jobs` page. + ## Fixed @@ -23,6 +25,8 @@ Moving to SolidQueue and SolidCache will require creating new SQLite databases, - SolidQueue is now being used for background jobs instead of Sidekiq. - SolidCable is now being used as ActionCable adapter. - Background jobs are now being run as Puma plugin instead of separate Docker container. +- The `rc` docker image is now being built for amd64 architecture only to speed up the build process. +- Deleting an import now works significantly faster. diff --git a/app/services/imports/destroy.rb b/app/services/imports/destroy.rb index fc0a6ff2..76870fdb 100644 --- a/app/services/imports/destroy.rb +++ b/app/services/imports/destroy.rb @@ -9,7 +9,10 @@ class Imports::Destroy end def call - @import.destroy! + ActiveRecord::Base.transaction do + @import.points.delete_all + @import.destroy! + end Stats::BulkCalculator.new(@user.id).call end diff --git a/app/services/jobs/create.rb b/app/services/jobs/create.rb index 0d46b60f..d4176652 100644 --- a/app/services/jobs/create.rb +++ b/app/services/jobs/create.rb @@ -21,6 +21,7 @@ class Jobs::Create raise InvalidJobName, 'Invalid job name' end + # TODO: bulk enqueue reverse geocoding with ActiveJob points.find_each(&:async_reverse_geocode) end end diff --git a/config/cable.yml b/config/cable.yml index d0da7a95..fd1a239f 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -4,7 +4,12 @@ # to make the web console appear. development: - adapter: async + adapter: solid_cable + connects_to: + database: + writing: cable + polling_interval: 0.1.seconds + message_retention: 1.day test: adapter: test diff --git a/config/database.yml b/config/database.yml index 5f4dff65..75004309 100644 --- a/config/database.yml +++ b/config/database.yml @@ -26,6 +26,10 @@ development: <<: *sqlite_default database: <%= ENV['CACHE_DATABASE_PATH'] || 'db/cache.sqlite3' %> migrations_paths: db/cache_migrate + cable: + <<: *sqlite_default + database: <%= ENV['CABLE_DATABASE_PATH'] || 'db/cable.sqlite3' %> + migrations_paths: db/cable_migrate test: primary: diff --git a/config/queue.yml b/config/queue.yml index 83b066ed..50e1f5b4 100644 --- a/config/queue.yml +++ b/config/queue.yml @@ -6,7 +6,7 @@ default: &default workers: - queues: "*" threads: 3 - processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %> + processes: <%= ENV['BACKGROUND_PROCESSING_CONCURRENCY'] || ENV.fetch("JOB_CONCURRENCY", 10) %> polling_interval: 2 - queues: imports threads: 5 diff --git a/db/cable_schema.rb b/db/cable_schema.rb index 90beff61..55cdb550 100644 --- a/db/cable_schema.rb +++ b/db/cable_schema.rb @@ -11,9 +11,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema[8.0].define(version: 1) do - # These are extensions that must be enabled in order to support this database - enable_extension "pg_catalog.plpgsql" - create_table "solid_cable_messages", force: :cascade do |t| t.binary "channel", null: false t.binary "payload", null: false @@ -22,5 +19,6 @@ ActiveRecord::Schema[8.0].define(version: 1) do t.index ["channel"], name: "index_solid_cable_messages_on_channel" t.index ["channel_hash"], name: "index_solid_cable_messages_on_channel_hash" t.index ["created_at"], name: "index_solid_cable_messages_on_created_at" + t.index ["id"], name: "index_solid_cable_messages_on_id", unique: true end end diff --git a/db/cache_schema.rb b/db/cache_schema.rb index 3cf97e44..fe62ea4a 100644 --- a/db/cache_schema.rb +++ b/db/cache_schema.rb @@ -11,9 +11,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema[8.0].define(version: 1) do - # These are extensions that must be enabled in order to support this database - enable_extension "pg_catalog.plpgsql" - create_table "solid_cache_entries", force: :cascade do |t| t.binary "key", null: false t.binary "value", null: false diff --git a/db/queue_schema.rb b/db/queue_schema.rb index 089e9380..4b2cdcdc 100644 --- a/db/queue_schema.rb +++ b/db/queue_schema.rb @@ -11,9 +11,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema[8.0].define(version: 1) do - # These are extensions that must be enabled in order to support this database - enable_extension "pg_catalog.plpgsql" - create_table "solid_queue_blocked_executions", force: :cascade do |t| t.bigint "job_id", null: false t.string "queue_name", null: false diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index f590f6d7..1877d174 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -106,7 +106,6 @@ services: - dawarich_public:/var/app/public - dawarich_watched:/var/app/tmp/imports/watched - dawarich_storage:/var/app/storage - - dawarich_db_data:/dawarich_db_data networks: - dawarich stdin_open: true