Skip to content

Commit

Permalink
Add Solid Cable adapter for ActionCable
Browse files Browse the repository at this point in the history
Switching the adapter is not expected to make any noticeable difference and is in line with CodeOcean. The new Solid Cable adapter is also shipping with Rails 8 by default.
  • Loading branch information
MrSerth committed Sep 25, 2024
1 parent 18c85e1 commit 4846c88
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ AllCops:
NewCops: enable
Exclude:
- 'bin/*'
- 'db/schema.rb'
- 'db/*schema.rb'
- 'vendor/**/*'
# Ignore local files for faster processing
- 'tmp/**/*'
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ gem 'sassc-rails'
gem 'shakapacker', '8.0.2'
gem 'simple_form'
gem 'slim-rails'
gem 'solid_cable'
gem 'solid_queue'
gem 'sprockets-rails'
gem 'terser', require: false
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ GEM
rexml (~> 3.2)
rubocop (>= 1.0, < 2.0)
slim (>= 3.0, < 6.0)
solid_cable (2.0.2)
rails (>= 7.2)
solid_queue (0.7.1)
activejob (>= 7.1)
activerecord (>= 7.1)
Expand Down Expand Up @@ -666,6 +668,7 @@ DEPENDENCIES
simplecov
slim-rails
slim_lint
solid_cable
solid_queue
sprockets-rails
stackprof
Expand Down
23 changes: 18 additions & 5 deletions config/cable.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
default: &default
adapter: solid_cable # OR postgresql OR redis

### Config options for `solid_cable`
connects_to:
database:
writing: cable
polling_interval: 0.1.seconds
message_retention: 1.day
autotrim: true
silence_polling: true

### Config options for `redis`
# url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
# channel_prefix: codeharbor_production

development:
adapter: postgresql
<<: *default

test:
adapter: test

production:
adapter: postgresql # redis
# all other options below are only used for redis
# url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
# channel_prefix: codeharbor_production
<<: *default
18 changes: 14 additions & 4 deletions config/database.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ default: &default
<% end %>

development:
<<: *default
database: codeharbor_development
primary: &primary_development
<<: *default
database: codeharbor_development
cable:
<<: *primary_development
database: codeharbor_development_cable
migrations_paths: db/cable_migrate

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
Expand All @@ -56,5 +61,10 @@ test:
# for a full overview on how database connection configuration can be specified.
#
production:
<<: *default
database: codeharbor_production
primary: &primary_production
<<: *default
database: codeharbor_production
cable:
<<: *primary_production
database: codeharbor_production_cable
migrations_paths: db/cable_migrate
25 changes: 25 additions & 0 deletions db/cable_schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4846c88

Please sign in to comment.