Skip to content

Commit

Permalink
refactor github actions file
Browse files Browse the repository at this point in the history
  • Loading branch information
ankithads committed Aug 8, 2024
1 parent d738345 commit 31aed1a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 10 deletions.
51 changes: 41 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: tests
on:
push:

jobs:
jobs:
rubocop:
runs-on: ubuntu-latest
env:
Expand All @@ -24,7 +24,6 @@ jobs:
fail-fast: false
matrix:
ruby_version: ["3.0", "3.1", "3.2", "3.3"]

runs-on: ubuntu-latest
services:
postgres:
Expand All @@ -40,7 +39,6 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 10
env:
PGDATABASE: que-test
PGUSER: ubuntu
Expand All @@ -63,7 +61,6 @@ jobs:
fail-fast: false
matrix:
ruby_version: ["3.0", "3.1", "3.2", "3.3"]

runs-on: ubuntu-latest
services:
postgres:
Expand All @@ -79,7 +76,43 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 10
env:
PGDATABASE: que-test
PGUSER: ubuntu
PGPASSWORD: password
PGHOST: localhost
BUNDLE_RUBYGEMS__PKG__GITHUB__COM: gocardless-robot-readonly:${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: "${{ matrix.ruby-version }}"
- name: Run specs
run: |
bundle exec rspec
active_record_with_lock_adapter_rspec:
strategy:
fail-fast: false
matrix:
ruby_version: ["3.0", "3.1", "3.2", "3.3"]
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14.2
env:
POSTGRES_DB: que-test
POSTGRES_USER: ubuntu
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 10
lock_database:
image: postgres:14.2
env:
Expand All @@ -92,8 +125,7 @@ jobs:
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 10
--health-retries 10
env:
PGDATABASE: que-test
PGUSER: ubuntu
Expand All @@ -104,15 +136,14 @@ jobs:
LOCK_PGUSER: ubuntu
LOCK_PGPASSWORD: password
LOCK_PGHOST: localhost
ADAPTER: ActiveRecordWithLock
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: "${{ matrix.ruby-version }}"
- name: Run specs
run: |
bundle exec rspec
- name: Run Specs With ActiveRecordWithLock Adapter
run: ADAPTER="ActiveRecordWithLock" bundle exec rspec
run: bundle exec rspec

1 change: 1 addition & 0 deletions lib/que/locker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def initialize(queue:, cursor_expiry:, window: nil, budget: nil, secondary_queue
@queue_expires_at = {}
@secondary_queues = secondary_queues
@consolidated_queues = Array.wrap(queue).concat(secondary_queues)

# Create a bucket that has 100% capacity, so even when we don't apply a limit we
# have a valid bucket that we can use everywhere
@leaky_bucket = LeakyBucket.new(window: window || 1.0, budget: budget || 1.0)
Expand Down

0 comments on commit 31aed1a

Please sign in to comment.