Sha256: 73119cabe1ad391af33d05697361a6ebbc7d7cadced3fa490125e23df699e664
Contents?: true
Size: 853 Bytes
Versions: 1
Compression:
Stored size: 853 Bytes
Contents
require 'parallel' require 'retries' require 'ostruct' module BitsDealer module Monitor def start_monitors @monitor_data = OpenStruct.new({ tickers: [], stats: {} }) _monit_tickers _process_stats end private attr_reader :monitor def monitor_tickers Thread.kill(@tickers_thread) if @tickers_thread Thread.abort_on_exception = true @tickers_thread = Thread.new do loop do books = BitsDealer::Books::ALL_BOOKS tickers = Parallel.map(books) do |book| with_retries(:max_tries => 3) { Bitsor.ticker(book: book.id) } end @monitor_data.tickers = [{ created_at: Time.now.to_i, data: tickers }] + @monitor_data.tickers[0..99] sleep 15 end end end def process_stats end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bits_dealer-0.1.1 | lib/bits_dealer/commands/monitor.rb |