nukeproof/oanda_api ã®ã³ãã¯ã·ã§ã³ãªã¼ã¯åé¡ã¨ãã®å¯¾ç
OANDA fx Trade APIã®Rubyã¯ã©ã¤ã¢ã³ããnukeproof/oanda_apiãã«ã¯ãTCPã³ãã¯ã·ã§ã³ãªã¼ã¯ã®åé¡ããããé·æéé£ç¶ã§å©ç¨ãã¦ããã¨ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ãæ¯æ¸ãã¾ãã
å é¨ã§å©ç¨ãã¦ãã persistent_http ã®å¤ããã¼ã¸ã§ã³ã«ããä¸å ·åãåå (ææ°ã®2.0.1ã§ã¯æ¹ä¿®æ¸ã¿)ã®ãããGemfileãªã©ã§ææ°ãã¼ã¸ã§ã³ã使ãããã«ããã¨åé¿ã§ãã¾ãã
gem 'persistent_http', '2.0.1'
åé¡ã®è©³ç´°
Jijiã10æ¥ç¨åº¦é£ç¶ç¨¼åããã¦ãã¦çºè¦ãçªç¶ã以ä¸ã®ã¨ã©ã¼ãçºçããããã«ãªãã¾ããã
E, [2015-12-09T01:23:06.337582 #7932] ERROR -- : Too many open files - getaddrinfo (Errno::EMFILE) /home/yamautim/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:879:in `initialize' /home/yamautim/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:879:in `open' /home/yamautim/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:879:in `block in connect'
lsof ã³ãã³ãã®åºåè¡æ°ãå°ããã¤å¢ãã¦ããã¾ãã
$ lsof -p <Jijiã®pid> | wc -l 77 $ lsof -p <Jijiã®pid> | wc -l 79
èµ·åç´å¾ã¨ããã°ããèµ·åããå¾ã§ãlsofã®åºåçµæã®Diffãã¨ãã¨ãCLOSE_WAITã®httpsã³ãã¯ã·ã§ã³ãå¢å ãã¦ãã¾ããã
ruby 4389 xxxx 23u IPv4 9265756 0t0 TCP localhost.localdomain:35773->unknown.xxxx.net:https (CLOSE_WAIT)
å¤åãã®HTTPSéä¿¡ãªã®ã§ãOANDA ã¸ã®ã¢ã¯ã»ã¹ã£ã½ãã
åå
æåã«ãæ¸ãã¾ããããpersistent_http ã®å¤ããã¼ã¸ã§ã³ã«ããä¸å ·åãåå ã§ããææ°ã® 2.0.1 ã使ãã°æ¹ä¿®ããã¾ãã
- 1.0.6ã§ã¯ãå é¨ã§å©ç¨ãã¦ããGenePoolã«æ¸¡ããªãã·ã§ã³ãnilã«ãªã£ã¦ãããã³ãã¯ã·ã§ã³ã®ç ´æ£ãæ£ããè¡ãããªãç¶æ ã«ãªã£ã¦ãã¾ãã
- ãã®ã³ãããã§æ¹ä¿®ããã¦ãã¦ãææ°ã® 2.0.1 ã使ãã°OKã
- ãã ããoanda_api ãç´æ¥ä¾åãã¦ãã persistent_httparty 㧠ãã¼ã¸ã§ã³2以ä¸ã使ãããæ示ããã¦ãããããæ®éã«ä½¿ã㨠1.0.6 ã使ããã¦ãã¾ãã¾ãã
- ãã®ãããGemfileãªã©ã§ææ°ãã¼ã¸ã§ã³ã使ãããã«æ示ããçã®å¯¾å¿ãå¿ è¦ã§ãã
- ã¡ãªã¿ã«ãpersistent_httparty ã«ãä¾åããpersistent_httpã®ãã¼ã¸ã§ã³ãä¸ããPull Requestã¯ããã®ã§ããããã¼ã¸ããã¦ããªãããã§ãã»ã»ã»ã