Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply SKIP LOCKED optimization v4.1.7 #3

Draft
wants to merge 72 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
c6814e6
Remove force flag from migration
rvasquez-flip4new Mar 23, 2018
9e35c2e
Optimize default sql performance
racerpeter Feb 6, 2019
d3036fa
Update notes
racerpeter Feb 7, 2019
49c33f2
Use `find_by` instead of `where` to avoid implicit ordering
racerpeter Feb 12, 2019
17de0da
Active record does not yet work with sqlite 1.4
albus522 Feb 18, 2019
00eb050
Update ruby versions
albus522 Feb 18, 2019
c4c130d
Rubocop updates for latest rubocop
albus522 Feb 18, 2019
86de647
Merge pull request #166 from collectiveidea/fix-travis
albus522 Feb 18, 2019
2dab4b9
Bump travis ruby and jdk versions
albus522 Aug 16, 2019
6615cf6
Add required database services
albus522 Aug 16, 2019
af62514
Add frozen_string_literal magic comment
albus522 Aug 16, 2019
0b3a9ee
Correct rubocop configuration
albus522 Aug 16, 2019
5429c1a
Drop old mysql activerecord builds
albus522 Aug 16, 2019
aa1a4d8
Merge pull request #175 from collectiveidea/travis-updates
albus522 Aug 16, 2019
745410d
Allow active record 6.0
albus522 Feb 18, 2019
ece98a3
Temporarily point at our compatibility branch
albus522 Feb 18, 2019
1307e3d
Bump postgres
albus522 Feb 18, 2019
340add1
Fix primary key issue for Rails 3.x and 4.0 and mysql 5.7
p8 Jul 9, 2019
80b3736
Tweak patch for mysql2 primary key
albus522 Aug 20, 2019
fd96df6
Update travis matrix for activerecord 6
albus522 Aug 20, 2019
94b2604
Merge pull request #167 from collectiveidea/rails-6-compatibility
albus522 Aug 20, 2019
423830f
Remove defunct badges
albus522 Aug 20, 2019
337c09c
Prepare 4.1.4 release
albus522 Aug 20, 2019
de6b316
Add Railtie to delayed_job_active_record
yuki24 Apr 29, 2015
573dd72
Fix Rails autoloading
p8 Jul 9, 2019
b7a609b
Backward compatibility with Rails 3.0
racerpeter Nov 8, 2019
8e5e5e1
Merge pull request #152 from flip4dev/bugfix/remove-force-true-from-m…
albus522 Nov 8, 2019
750fada
Pass ID to find
racerpeter Nov 8, 2019
4f0a7f5
Use reload
racerpeter Nov 8, 2019
f654e63
Merge pull request #165 from racerpeter/optimized-mysql-strategy
albus522 Nov 8, 2019
286c834
Cleanup test database
albus522 Nov 8, 2019
8891789
Fix for rubocop update
albus522 Nov 8, 2019
ceb5b07
A touch of cleanup to the default sql method
albus522 Nov 8, 2019
31fe97c
Merge pull request #172 from p8/fix/autoload
albus522 Nov 8, 2019
0d1ed9a
Refactor sql statement
Dec 27, 2016
d602a5d
Fix spec setup for older activerecord
albus522 Nov 8, 2019
6a899eb
Updates to support rubocop 1.5.2
albus522 Dec 7, 2020
36c7813
Cleanup from EOL ruby and rails versions
albus522 Dec 7, 2020
44eabb0
Attempt to use github actions
albus522 Dec 7, 2020
eb6c952
Update db config for Github actions
albus522 Dec 7, 2020
65c7907
Fix coveralls report
albus522 Dec 7, 2020
15f168f
Allow experimental failures
albus522 Dec 8, 2020
2b6a1bf
Set minimum version for simplecov
albus522 Dec 8, 2020
bee840d
Older versions of AR do not work with PG 12
albus522 Dec 8, 2020
33929a5
Correct version incompatabilities in old ruby
albus522 Dec 8, 2020
be150fd
mysql segfaults on ruby 2.1
albus522 Dec 8, 2020
110ea0a
Add packaging and performance rubocops
albus522 Dec 8, 2020
6575225
Add rubocop workflow
albus522 Dec 8, 2020
187ee42
Remove travis config
albus522 Dec 8, 2020
b4686bb
Update readme badge
albus522 Dec 8, 2020
3954b43
Merge pull request #183 from collectiveidea/dg-move-to-github-actions
albus522 Dec 8, 2020
cf6f864
Updated jdbc adapters were released
albus522 Dec 9, 2020
c459b7c
Rely on latest jdbc code for edge testing
albus522 Dec 9, 2020
d88886e
Allow rails 6.1
albus522 Dec 9, 2020
3d6f9f7
Add Rails 6.1 to biuld grid
albus522 Dec 9, 2020
9bcaa27
Correct legacy database adapter versions
albus522 Dec 9, 2020
39b739b
Merge pull request #184 from collectiveidea/dg-rails-6-1
albus522 Dec 9, 2020
001b246
Prepare 4.1.5 release
albus522 Dec 9, 2020
0935061
Revert "Fix Rails autoloading"
albus522 Mar 26, 2021
cb5dce5
Merge pull request #191 from collectiveidea/revert-172-fix/autoload
albus522 Mar 26, 2021
d65b0f9
Prepare 4.1.6 release
albus522 Mar 26, 2021
cded883
Support Rails 7.0
willnet Oct 11, 2021
72da767
Fix a broken spec due to Psych >= 4
willnet Nov 1, 2021
3715b87
Set rubygems_mfa_required in gemspec
willnet Nov 15, 2021
47e4571
Enclose every ruby version in quotations
willnet Jan 17, 2022
fa6187c
Add Ruby 3.1 on CI
willnet Jan 17, 2022
dd7e90d
Use Rails 7.0.1
willnet Jan 17, 2022
e6d350a
Update the test matrix
albus522 Jan 18, 2022
7bd1abb
Allow less than Active Record 8
albus522 Jan 18, 2022
3a3e5ee
Merge pull request #205 from collectiveidea/dg-fixup-rails-7-0
albus522 Jan 18, 2022
97f26a3
Prepare 4.1.7 release
albus522 Jan 18, 2022
e260ca2
Apply SKIP LOCKED optimization for reserving a delayed job entry
kicktheken Jul 24, 2018
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
220 changes: 220 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', '3.1', 'jruby-9.3']
gemfile:
- gemfiles/mysql2/6-0.gemfile
- gemfiles/postgresql/6-0.gemfile
- gemfiles/sqlite3/6-0.gemfile
- gemfiles/mysql2/6-1.gemfile
- gemfiles/postgresql/6-1.gemfile
- gemfiles/sqlite3/6-1.gemfile
- gemfiles/mysql2/7-0.gemfile
- gemfiles/postgresql/7-0.gemfile
- gemfiles/sqlite3/7-0.gemfile
include:
#
# The future
#
# Active Record head
- ruby: '2.7'
gemfile: gemfiles/mysql2/master.gemfile
- ruby: '2.7'
gemfile: gemfiles/postgresql/master.gemfile
- ruby: '2.7'
gemfile: gemfiles/sqlite3/master.gemfile
- ruby: '3.0'
gemfile: gemfiles/mysql2/master.gemfile
- ruby: '3.0'
gemfile: gemfiles/postgresql/master.gemfile
- ruby: '3.0'
gemfile: gemfiles/sqlite3/master.gemfile
- ruby: '3.1'
gemfile: gemfiles/mysql2/master.gemfile
- ruby: '3.1'
gemfile: gemfiles/postgresql/master.gemfile
- ruby: '3.1'
gemfile: gemfiles/sqlite3/master.gemfile
# MRI Ruby head
- ruby: head
gemfile: gemfiles/mysql2/master.gemfile
- ruby: head
gemfile: gemfiles/postgresql/master.gemfile
- ruby: head
gemfile: gemfiles/sqlite3/master.gemfile
- ruby: head
gemfile: gemfiles/mysql2/7-0.gemfile
- ruby: head
gemfile: gemfiles/postgresql/7-0.gemfile
- ruby: head
gemfile: gemfiles/sqlite3/7-0.gemfile
# JRuby head
- ruby: jruby-head
gemfile: gemfiles/mysql2/6-1.gemfile
- ruby: jruby-head
gemfile: gemfiles/postgresql/6-1.gemfile
- ruby: jruby-head
gemfile: gemfiles/sqlite3/6-1.gemfile

#
# Current
#
# MRI Ruby 2.6
- ruby: '2.6'
gemfile: gemfiles/mysql2/6-0.gemfile
- ruby: '2.6'
gemfile: gemfiles/postgresql/6-0.gemfile
- ruby: '2.6'
gemfile: gemfiles/sqlite3/6-0.gemfile
- ruby: '2.6'
gemfile: gemfiles/mysql2/6-1.gemfile
- ruby: '2.6'
gemfile: gemfiles/postgresql/6-1.gemfile
- ruby: '2.6'
gemfile: gemfiles/sqlite3/6-1.gemfile
# Rails 5.2
- ruby: '2.6'
gemfile: gemfiles/mysql2/5-2.gemfile
- ruby: '2.6'
gemfile: gemfiles/postgresql/5-2.gemfile
- ruby: '2.6'
gemfile: gemfiles/sqlite3/5-2.gemfile
- ruby: '2.7'
gemfile: gemfiles/mysql2/5-2.gemfile
- ruby: '2.7'
gemfile: gemfiles/postgresql/5-2.gemfile
- ruby: '2.7'
gemfile: gemfiles/sqlite3/5-2.gemfile
- ruby: 'jruby-9.2'
gemfile: gemfiles/mysql2/5-2.gemfile
- ruby: 'jruby-9.2'
gemfile: gemfiles/postgresql/5-2.gemfile
- ruby: 'jruby-9.2'
gemfile: gemfiles/sqlite3/5-2.gemfile

#
# The past
#
# EOL Active Record
# Rails 3.2 was maintained longer and is ruby 2.2 compatible
- ruby: '2.2'
gemfile: gemfiles/postgresql/3-2.gemfile
- ruby: '2.2'
gemfile: gemfiles/sqlite3/3-2.gemfile
# Rails <= 4.0 was only compatible with ruby 2.0
# The test were running, but there are known incompatibilites
- ruby: 2.0.0
gemfile: gemfiles/postgresql/3-0.gemfile
- ruby: 2.0.0
gemfile: gemfiles/sqlite3/3-0.gemfile
- ruby: 2.0.0
gemfile: gemfiles/postgresql/3-1.gemfile
- ruby: 2.0.0
gemfile: gemfiles/sqlite3/3-1.gemfile
- ruby: 2.0.0
gemfile: gemfiles/postgresql/4-0.gemfile
- ruby: 2.0.0
gemfile: gemfiles/sqlite3/4-0.gemfile
# Rails 4.1 was only compatible with ruby 2.1
- ruby: '2.1'
gemfile: gemfiles/postgresql/4-1.gemfile
- ruby: '2.1'
gemfile: gemfiles/sqlite3/4-1.gemfile
# Rails 4.2 was EOL with the release of 6.0 and compatible with ruby 2.4
- ruby: '2.4'
gemfile: gemfiles/mysql2/4-2.gemfile
- ruby: '2.4'
gemfile: gemfiles/postgresql/4-2.gemfile
- ruby: '2.4'
gemfile: gemfiles/sqlite3/4-2.gemfile
# Rails 5.0 was EOL with the release of 5.2 and compatible with ruby 2.4
- ruby: '2.4'
gemfile: gemfiles/mysql2/5-0.gemfile
- ruby: '2.4'
gemfile: gemfiles/postgresql/5-0.gemfile
- ruby: '2.4'
gemfile: gemfiles/sqlite3/5-0.gemfile
# Rails 5.1 was EOL with the release of 6.0 and compatible with ruby 2.5
- ruby: '2.5'
gemfile: gemfiles/mysql2/5-1.gemfile
- ruby: '2.5'
gemfile: gemfiles/postgresql/5-1.gemfile
- ruby: '2.5'
gemfile: gemfiles/sqlite3/5-1.gemfile

#
# The parallel dimension
#
# Rubinius (Isn't supported on Github Actions)
# - rvm: rbx-2
# gemfile: gemfiles/mysql2/6-0.gemfile
# - rvm: rbx-2
# gemfile: gemfiles/postgresql/6-0.gemfile
# - rvm: rbx-2
# gemfile: gemfiles/sqlite3/6-0.gemfile
continue-on-error: ${{ endsWith(matrix.gemfile, 'master.gemfile') || endsWith(matrix.ruby, 'head') }}
services:
postgres:
# AR before 4.2.6 doesn't work with 12
image: postgres:11-alpine
# Provide the password for postgres
env:
POSTGRES_DB: delayed_job_test
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: delayed_job_test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
run: bundle exec rspec
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.ruby }}-${{ matrix.gemfile }}
parallel: true

finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
30 changes: 30 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: RuboCop

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Generate lockfile for cache key
run: bundle lock
- name: Cache gems
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-rubocop-
- name: Install gems
run: |
bundle config path vendor/bundle
bundle config set without 'default test'
bundle install --jobs 4 --retry 3
- name: Run RuboCop
run: bundle exec rubocop --parallel
45 changes: 33 additions & 12 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Load the rubocop-rspec gem
require: rubocop-rspec
require:
- rubocop-packaging
- rubocop-performance
- rubocop-rails
- rubocop-rspec

Rails:
Enabled: true
AllCops:
Exclude:
- lib/**/templates/*
- vendor/**/*
NewCops: enable
SuggestExtensions: false

#################
# [i] Overrides #
Expand All @@ -29,30 +34,32 @@ Style/EmptyMethod:
EnforcedStyle: expanded

# Align ends correctly.
EndAlignment:
Layout/EndAlignment:
EnforcedStyleAlignWith: variable

LineLength:
Layout/LineLength:
Max: 120

SignalException:
Style/SignalException:
EnforcedStyle: only_raise

SpaceInsideBlockBraces:
Layout/SpaceInsideBlockBraces:
SpaceBeforeBlockParameters: true

SpaceInsideHashLiteralBraces:
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: space

BracesAroundHashParameters:
EnforcedStyle: context_dependent

StringLiterals:
Style/StringLiterals:
EnforcedStyle: double_quotes

#################
# Disabled cops #
#################
# We actually still work with ruby 2.0 but this setting only supports 2.4+
# We aren't going to drop old versions just to make rubocop happy.
Gemspec/RequiredRubyVersion:
Enabled: false

Metrics/ClassLength:
Enabled: false

Expand All @@ -77,6 +84,9 @@ Style/FormatString:
Style/Lambda:
Enabled: false

Style/MultipleComparison:
Enabled: false

Style/NegatedIf:
Enabled: false

Expand All @@ -101,6 +111,9 @@ Style/WordArray:
Rails/HasAndBelongsToMany:
Enabled: false

Rails/RakeEnvironment:
Enabled: false

# enforces using the class name in a describe block (e.g. `describe TestedClass do`)
RSpec/DescribeClass:
Enabled: false
Expand All @@ -123,12 +136,15 @@ RSpec/MessageExpectation:
RSpec/MultipleExpectations:
Enabled: false

RSpec/MultipleMemoizedHelpers:
Enabled: false

# enforces rules about how many nested `describe` blocks are allowed
RSpec/NestedGroups:
Enabled: false

# enforces rules about using `it` or `describe` block methods instead of `feature` or `scenario`
Capybara/FeatureMethods:
RSpec/Capybara/FeatureMethods:
Enabled: false

###################
Expand All @@ -149,3 +165,8 @@ Style/FormatStringToken:

Style/NumericPredicate:
Enabled: false

# We still allow really old versions of Ruby and Rails
# While I like the safe navigator, we don't want to use it here just yet
Style/SafeNavigation:
Enabled: false
Loading