Skip to content

Commit a9e0f6f

Browse files
authored
Merge pull request #1033 from code0-tech/add-actioncable-health-route
Add health route for cable server
2 parents 6eef996 + 11d641a commit a9e0f6f

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

config.cable.ru

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,19 @@
33
require_relative 'config/environment'
44
Rails.application.eager_load!
55

6+
map '/health/liveness' do
7+
run lambda { |_env|
8+
begin
9+
ApplicationRecord.connection.execute('SELECT 1')
10+
[200, { 'content-type' => 'text/plain' }, ['OK']]
11+
rescue StandardError => e
12+
if Rails.env.local?
13+
[500, { 'content-type' => 'text/plain' }, [e.message]]
14+
else
15+
[500, { 'content-type' => 'text/plain' }, ['ERROR']]
16+
end
17+
end
18+
}
19+
end
20+
621
run ActionCable.server

0 commit comments

Comments
 (0)