Skip to content

Commit

Permalink
+ falcon
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Sep 14, 2024
1 parent 5132136 commit 1fc2b38
Show file tree
Hide file tree
Showing 10 changed files with 311 additions and 104 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
- server: "iodine"
rails_version: "dev"
scenario: "broadcast"
- server: "falcon"
rails_version: "dev"
scenario: "broadcast"
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
Expand Down Expand Up @@ -66,6 +69,8 @@ jobs:
include:
- server: "iodine"
rails_version: "dev"
- server: "falcon"
rails_version: "dev"
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ gem "puma", "~> 6.4"
gem "redis", "~> 5.0"

# Async setup
# TODO
gem "falcon"
gem "async-websocket"
gem "async-redis"

# Iodine
gem "iodine", require: false
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ anyt-anycable: bin/dist/anycable-go
bundle exec anyt -c "bin/dist/anycable-go" --target-url="ws://localhost:8080/cable"

anyt-iodine:
@bundle exec anyt --self-check --require=scripts/anyt/rails/*.rb --rails-command="bundle exec iodine -p 9292 -t 5 -w 2 %{config}" --except=features/server_restart
@bundle exec anyt --self-check --require="{lib/servers/iodine.rb,scripts/anyt/rails/*.rb}" \
--rails-command="bundle exec iodine scripts/anyt/iodine.ru -p 9292 -t 5 -w 2" \
--except=streams/single

anyt-falcon:
ACTION_CABLE_ADAPTER=redis \
bundle exec anyt --self-check --require="{lib/servers/falcon.rb,scripts/anyt/rails/*.rb}" \
--rails-command="bundle exec ruby scripts/anyt/falcon.rb" \
--except=features/server_restart,request/disconnection,features/channel_state

.PHONY: websocket-bench
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ $ bundle exec bento --anycable

...

# Falcon
$ bundle exec bento --falcon

⚡️ Running Action Cable via falcon

...

# Iodine
$ bundle exec bento --iodine

Expand Down
4 changes: 4 additions & 0 deletions lib/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class App < Rails::Application
end
end

ActionCable.server.config.cable = {
"adapter" => ENV.fetch("ACTION_CABLE_ADAPTER", "redis"),
"url" => ENV["REDIS_URL"]
}
ActionCable.server.config.connection_class = -> { ApplicationCable::Connection }
ActionCable.server.config.disable_request_forgery_protection = true
ActionCable.server.config.logger = Rails.logger
Expand Down
5 changes: 1 addition & 4 deletions lib/servers/anycable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
require "redis"
require "anycable-rails"

ActionCable.server.config.cable = {
"adapter" => $benchmark_server == :anycable ? "any_cable" : "redis",
"url" => ENV["REDIS_URL"]
}
ActionCable.server.config.cable = {"adapter" => "any_cable"}

class BenchmarkServer
def self.run!
Expand Down
Loading

0 comments on commit 1fc2b38

Please sign in to comment.