jobs: remove DelayedJobs.
Remove the DelayedJobs gem and database table. Completes the transition to GoodJob started inc06bfa64fandf4953549a. Downstream users can upgrade as follows: * Stop the Rails server. * Stop the DelayedJobs worker (normally running as `bin/delayed_job` or `bin/rails jobs:work`). * Run `bin/rails jobs:work` to finish any pending delayed jobs. * Run `bin/rails db:migrate` to create the good_jobs table and drop the delayed_jobs table. * Start the Rails server again. * Start the GoodJobs worker with `bin/good_job start`.
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -4,8 +4,6 @@ gem 'dotenv-rails', :require => "dotenv/rails-now"
|
|||||||
|
|
||||||
gem "rails", "~> 6.0"
|
gem "rails", "~> 6.0"
|
||||||
gem "pg"
|
gem "pg"
|
||||||
gem "delayed_job"
|
|
||||||
gem "delayed_job_active_record"
|
|
||||||
gem "simple_form"
|
gem "simple_form"
|
||||||
gem "sanitize"
|
gem "sanitize"
|
||||||
gem 'ruby-vips'
|
gem 'ruby-vips'
|
||||||
|
|||||||
@@ -135,11 +135,6 @@ GEM
|
|||||||
dead_end (3.1.0)
|
dead_end (3.1.0)
|
||||||
debug_inspector (1.1.0)
|
debug_inspector (1.1.0)
|
||||||
declarative (0.0.20)
|
declarative (0.0.20)
|
||||||
delayed_job (4.1.9)
|
|
||||||
activesupport (>= 3.0, < 6.2)
|
|
||||||
delayed_job_active_record (4.1.6)
|
|
||||||
activerecord (>= 3.0, < 6.2)
|
|
||||||
delayed_job (>= 3.0, < 5)
|
|
||||||
derailed_benchmarks (2.1.1)
|
derailed_benchmarks (2.1.1)
|
||||||
benchmark-ips (~> 2)
|
benchmark-ips (~> 2)
|
||||||
dead_end
|
dead_end
|
||||||
@@ -537,8 +532,6 @@ DEPENDENCIES
|
|||||||
clockwork
|
clockwork
|
||||||
codecov
|
codecov
|
||||||
daemons
|
daemons
|
||||||
delayed_job
|
|
||||||
delayed_job_active_record
|
|
||||||
derailed_benchmarks
|
derailed_benchmarks
|
||||||
diff-lcs
|
diff-lcs
|
||||||
dotenv-rails
|
dotenv-rails
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/usr/bin/env ruby
|
|
||||||
|
|
||||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
|
|
||||||
require 'delayed/command'
|
|
||||||
Delayed::Job.connection.execute "set statement_timeout=0"
|
|
||||||
Delayed::Command.new(ARGV).daemonize
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
require 'delayed/plugin'
|
|
||||||
|
|
||||||
class DelayedJobTimeoutPlugin < ::Delayed::Plugin
|
|
||||||
callbacks do |lifecycle|
|
|
||||||
lifecycle.before(:execute) do |job|
|
|
||||||
Delayed::Job.connection.execute "set statement_timeout = 0"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
Delayed::Worker.logger = Logger.new(STDERR, level: :debug)
|
|
||||||
Delayed::Worker.default_queue_name = "default"
|
|
||||||
Delayed::Worker.destroy_failed_jobs = false
|
|
||||||
Delayed::Worker.plugins << DelayedJobTimeoutPlugin
|
|
||||||
24
db/migrate/20220104214319_drop_delayed_jobs.rb
Normal file
24
db/migrate/20220104214319_drop_delayed_jobs.rb
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
class DropDelayedJobs < ActiveRecord::Migration[6.1]
|
||||||
|
def up
|
||||||
|
drop_table :delayed_jobs
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
create_table :delayed_jobs do |t|
|
||||||
|
t.integer :priority, default: 0
|
||||||
|
t.integer :attempts, default: 0
|
||||||
|
t.text :handler
|
||||||
|
t.text :last_error
|
||||||
|
t.datetime :run_at
|
||||||
|
t.datetime :locked_at
|
||||||
|
t.datetime :failed_at
|
||||||
|
t.string :locked_by
|
||||||
|
t.timestamps null: false
|
||||||
|
t.string :queue
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :delayed_jobs, :run_at
|
||||||
|
add_index :delayed_jobs, :locked_at
|
||||||
|
add_index :delayed_jobs, :locked_by
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -475,46 +475,6 @@ CREATE SEQUENCE public.comments_id_seq
|
|||||||
ALTER SEQUENCE public.comments_id_seq OWNED BY public.comments.id;
|
ALTER SEQUENCE public.comments_id_seq OWNED BY public.comments.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE public.delayed_jobs (
|
|
||||||
id integer NOT NULL,
|
|
||||||
priority integer DEFAULT 0,
|
|
||||||
attempts integer DEFAULT 0,
|
|
||||||
handler text,
|
|
||||||
last_error text,
|
|
||||||
run_at timestamp without time zone,
|
|
||||||
locked_at timestamp without time zone,
|
|
||||||
failed_at timestamp without time zone,
|
|
||||||
locked_by character varying,
|
|
||||||
created_at timestamp without time zone NOT NULL,
|
|
||||||
updated_at timestamp without time zone NOT NULL,
|
|
||||||
queue character varying
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE SEQUENCE public.delayed_jobs_id_seq
|
|
||||||
AS integer
|
|
||||||
START WITH 1
|
|
||||||
INCREMENT BY 1
|
|
||||||
NO MINVALUE
|
|
||||||
NO MAXVALUE
|
|
||||||
CACHE 1;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: dmails; Type: TABLE; Schema: public; Owner: -
|
-- Name: dmails; Type: TABLE; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@@ -2331,13 +2291,6 @@ ALTER TABLE ONLY public.comment_votes ALTER COLUMN id SET DEFAULT nextval('publi
|
|||||||
ALTER TABLE ONLY public.comments ALTER COLUMN id SET DEFAULT nextval('public.comments_id_seq'::regclass);
|
ALTER TABLE ONLY public.comments ALTER COLUMN id SET DEFAULT nextval('public.comments_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: dmails id; Type: DEFAULT; Schema: public; Owner: -
|
-- Name: dmails id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@@ -2727,14 +2680,6 @@ ALTER TABLE ONLY public.comments
|
|||||||
ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE ONLY public.delayed_jobs
|
|
||||||
ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: dmails dmails_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
-- Name: dmails dmails_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@@ -3383,27 +3328,6 @@ CREATE INDEX index_comments_on_creator_ip_addr ON public.comments USING btree (c
|
|||||||
CREATE INDEX index_comments_on_post_id ON public.comments USING btree (post_id);
|
CREATE INDEX index_comments_on_post_id ON public.comments USING btree (post_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: index_delayed_jobs_on_locked_at; Type: INDEX; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE INDEX index_delayed_jobs_on_locked_at ON public.delayed_jobs USING btree (locked_at);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: index_delayed_jobs_on_locked_by; Type: INDEX; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE INDEX index_delayed_jobs_on_locked_by ON public.delayed_jobs USING btree (locked_by);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: index_delayed_jobs_on_run_at; Type: INDEX; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE INDEX index_delayed_jobs_on_run_at ON public.delayed_jobs USING btree (run_at);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_dmails_on_created_at; Type: INDEX; Schema: public; Owner: -
|
-- Name: index_dmails_on_created_at; Type: INDEX; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@@ -5181,6 +5105,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||||||
('20211018062916'),
|
('20211018062916'),
|
||||||
('20211023225730'),
|
('20211023225730'),
|
||||||
('20211121080239'),
|
('20211121080239'),
|
||||||
('20220101224048');
|
('20220101224048'),
|
||||||
|
('20220104214319');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user