From 10d119d34f759c90c68b1f234d5ecf54b7b59da9 Mon Sep 17 00:00:00 2001 From: DualFroz Date: Fri, 4 Sep 2026 22:48:21 +0200 Subject: [PATCH] feat(bin): extend console and server --- examples/blog/bin/console | 4 ++++ examples/blog/bin/server | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 examples/blog/bin/console diff --git a/examples/blog/bin/console b/examples/blog/bin/console new file mode 100755 index 0000000..98698b6 --- /dev/null +++ b/examples/blog/bin/console @@ -0,0 +1,4 @@ +require_relative '../app' +require 'prism' + +Prism::Cli.new(__dir__).console(['--prompt=blog> ']) diff --git a/examples/blog/bin/server b/examples/blog/bin/server index 7386e59..e466f89 100755 --- a/examples/blog/bin/server +++ b/examples/blog/bin/server @@ -1,6 +1,18 @@ require_relative '../app' -server = Prism::Server.new(Blog, port: (ARGV[0] || 3000).to_i).start +# A hard cap on the total number of live WebSocket connections this +# process will hold open at once (across every post's /cable stream +# combined), distinct from PostActivityChannel::MAX_VIEWERS_PER_POST which +# only bounds a single stream - without this, enough popular posts could +# still exhaust the process's file descriptors even though no individual +# post ever hits its own per-stream limit. +MAX_WEBSOCKET_CONNECTIONS = 2000 + +server = Prism::Server.new( + Blog, + port: (ARGV[0] || 3000).to_i, + max_websocket_connections: MAX_WEBSOCKET_CONNECTIONS +).start puts "listening on #{server.url}" trap('INT') { server.stop; exit } sleep