File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ class API
2121 attr_reader :multi_sign_secp_cell_type_hash
2222 attr_reader :multi_sign_secp_group_out_point
2323
24- def initialize ( host : CKB ::RPC ::DEFAULT_URL , mode : MODE ::TESTNET )
25- @rpc = CKB ::RPC . new ( host : host )
24+ def initialize ( host : CKB ::RPC ::DEFAULT_URL , mode : MODE ::TESTNET , timeout_config : { } )
25+ @rpc = CKB ::RPC . new ( host : host , timeout_config : timeout_config )
2626 if mode == MODE ::TESTNET || mode == MODE ::MAINNET
2727 # For testnet chain, we can assume the second cell of the first transaction
2828 # in the genesis block contains default lock script we can use here.
Original file line number Diff line number Diff line change @@ -28,9 +28,12 @@ class RPC
2828
2929 DEFAULT_URL = "http://localhost:8114"
3030
31- def initialize ( host : DEFAULT_URL )
31+ def initialize ( host : DEFAULT_URL , timeout_config : { } )
3232 @uri = URI ( host )
3333 @http = Net ::HTTP ::Persistent . new
34+ @http . open_timeout = timeout_config [ :open_timeout ] if timeout_config [ :open_timeout ]
35+ @http . read_timeout = timeout_config [ :read_timeout ] if timeout_config [ :read_timeout ]
36+ @http . write_timeout = timeout_config [ :write_timeout ] if timeout_config [ :write_timeout ]
3437 end
3538
3639 def method_missing ( method , *params )
You can’t perform that action at this time.
0 commit comments