emysql add_poop() 超时出错

emysql add_poop() 超时出错

(金庆的专栏)

sample/a_hello.erl 连接本机更改为连接局域网内的MySql服务器:

    emysql:add_pool(hello_pool, [{size,1},
        {host, "192.168.1.2"},
        ...


编译运行时会出现超时退出:

D:\...\deps\emysql\samples>erl -pa ../ebin -s a_hello run -s init stop -noshell
add_pool...{"init terminating in do_boot",{{nocatch,{failed_to_recv_packet_header,timeout}},[{init,start_it,1,[{file,"init.erl"},{line,1062}]},{init,start_em,1,[{file,"init.erl"},{line,1034}]}]}}

Crash dump is being written to: erl_crash.dump...done
init terminating in do_boot ()

设置 default_timeout 参数为 10s 就可以成功:
D:\...\deps\emysql\samples>erl -pa ../ebin -s a_hello run -s init
 stop -noshell -emysql default_timeout 10000


查看代码,缺省的 default_timeout 为8s。
当MySql没有skip-name-resolve时,连接MySql需要近10秒才能连上,
所以很容易出现超时错误。

已提交问题:
https://github.com/Eonblast/Emysql/issues/174

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值