Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ gem "resque", "~> 2.0"
gem "resque-pool"
gem "resque-heroku-signals" # gah, weirdly needed for graceful shutdown on heroku. https://github.com/resque/resque#heroku

# job queue
gem 'good_job'

gem 'honeybadger', '~> 4.0'

# Until we get things working under sprockets 4, lock to sprockets 3
Expand Down
15 changes: 15 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ GEM
faraday (~> 1.0)
oauth2 (~> 1.1)
erubi (1.10.0)
et-orbi (1.2.5)
tzinfo
ethon (0.14.0)
ffi (>= 1.15.0)
execjs (2.8.1)
Expand Down Expand Up @@ -222,13 +224,24 @@ GEM
rake
font-awesome-rails (4.7.0.7)
railties (>= 3.2, < 7)
fugit (1.5.2)
et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.4)
fx (0.6.2)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
gems (1.2.0)
geocoder (1.6.7)
globalid (0.5.2)
activesupport (>= 5.0)
good_job (2.4.1)
activejob (>= 5.2.0)
activerecord (>= 5.2.0)
concurrent-ruby (>= 1.0.2)
fugit (>= 1.1)
railties (>= 5.2.0)
thor (>= 0.14.1)
zeitwerk (>= 2.0)
google-api-client (0.53.0)
google-apis-core (~> 0.1)
google-apis-generator (~> 0.1)
Expand Down Expand Up @@ -421,6 +434,7 @@ GEM
nokogiri (~> 1.6)
rails (>= 5.0, < 6.2)
rdf
raabro (1.4.0)
racc (1.5.2)
rack (2.2.3)
rack-protection (2.1.0)
Expand Down Expand Up @@ -679,6 +693,7 @@ DEPENDENCIES
factory_bot_rails
faster_s3_url (< 2)
font-awesome-rails (~> 4.7)
good_job
hirefire-resource
honeybadger (~> 4.0)
html_aware_truncation (~> 1.0)
Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

web: bundle exec puma -C config/heroku_puma.rb

worker: bundle exec resque-pool
worker: bundle exec good_job start

# https://devcenter.heroku.com/articles/release-phase
release: bundle exec rake scihist:heroku:on_release
3 changes: 2 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
# config.cache_store = :mem_cache_store

# Use a real queuing backend for Active Job (and separate queues per environment)
config.active_job.queue_adapter = :resque
# config.active_job.queue_adapter = :resque
config.active_job.queue_adapter = :good_job

# We are not sharing a redis among multiple apps, seems no need to queue_name_prefix,
# and it makes it confusing when trying to set resque workers to work specific
Expand Down
29 changes: 29 additions & 0 deletions db/migrate/20211013184612_create_good_jobs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true
class CreateGoodJobs < ActiveRecord::Migration[5.2]
def change
enable_extension 'pgcrypto'

create_table :good_jobs, id: :uuid do |t|
t.text :queue_name
t.integer :priority
t.jsonb :serialized_params
t.timestamp :scheduled_at
t.timestamp :performed_at
t.timestamp :finished_at
t.text :error

t.timestamps

t.uuid :active_job_id
t.text :concurrency_key
t.text :cron_key
t.uuid :retried_good_job_id
end

add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: "index_good_jobs_on_scheduled_at"
add_index :good_jobs, [:queue_name, :scheduled_at], where: "(finished_at IS NULL)", name: :index_good_jobs_on_queue_name_and_scheduled_at
add_index :good_jobs, [:active_job_id, :created_at], name: :index_good_jobs_on_active_job_id_and_created_at
add_index :good_jobs, :concurrency_key, where: "(finished_at IS NULL)", name: :index_good_jobs_on_concurrency_key_when_unfinished
add_index :good_jobs, [:cron_key, :created_at], name: :index_good_jobs_on_cron_key_and_created_at
end
end
26 changes: 24 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2021_09_01_190230) do
ActiveRecord::Schema.define(version: 2021_10_13_184612) do

# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
enable_extension "pgcrypto"
enable_extension "plpgsql"

Expand Down Expand Up @@ -114,6 +115,27 @@
t.index ["checked_uri"], name: "index_fixity_checks_on_checked_uri"
end

create_table "good_jobs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.text "queue_name"
t.integer "priority"
t.jsonb "serialized_params"
t.datetime "scheduled_at"
t.datetime "performed_at"
t.datetime "finished_at"
t.text "error"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.uuid "active_job_id"
t.text "concurrency_key"
t.text "cron_key"
t.uuid "retried_good_job_id"
t.index ["active_job_id", "created_at"], name: "index_good_jobs_on_active_job_id_and_created_at"
t.index ["concurrency_key"], name: "index_good_jobs_on_concurrency_key_when_unfinished", where: "(finished_at IS NULL)"
t.index ["cron_key", "created_at"], name: "index_good_jobs_on_cron_key_and_created_at"
t.index ["queue_name", "scheduled_at"], name: "index_good_jobs_on_queue_name_and_scheduled_at", where: "(finished_at IS NULL)"
t.index ["scheduled_at"], name: "index_good_jobs_on_scheduled_at", where: "(finished_at IS NULL)"
end

create_table "interviewee_biographies", force: :cascade do |t|
t.string "name", null: false
t.jsonb "json_attributes"
Expand Down Expand Up @@ -147,7 +169,7 @@
t.index ["container_id"], name: "index_kithe_model_contains_on_container_id"
end

create_table "kithe_models", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
create_table "kithe_models", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
t.string "title", null: false
t.string "type", null: false
t.integer "position"
Expand Down