feat(bin): extend console and server
This commit is contained in:
1 parent
f841a7513c
commit
10d119d34f
2 files changed
+17
-1
No files matched your search
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
require_relative '../app'
|
||||||
|
require 'prism'
|
||||||
|
|
||||||
|
Prism::Cli.new(__dir__).console(['--prompt=blog> '])
|
||||||
@@ -1,6 +1,18 @@
|
|||||||
require_relative '../app'
|
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}"
|
puts "listening on #{server.url}"
|
||||||
trap('INT') { server.stop; exit }
|
trap('INT') { server.stop; exit }
|
||||||
sleep
|
sleep
|
||||||
Reference in new issue
Block a user