<commit_before>require 'ffi-rzmq'
require 'msgpack'

module BrokerHelper

  LOG_BROKER_INFO = false

  def run_broker(endpoint)

    Thread.new do
      puts "broker running" if LOG_BROKER_INFO

      Thread.handle_interrupt(RuntimeError => :immediate) do

        begin
          context = ZMQ::Context.create
          socket = context.socket ZMQ::ROUTER
          socket.setsockopt(ZMQ::LINGER, 0)
          socket.connect(endpoint)
          puts "broker connected" if LOG_BROKER_INFO

          socket.recv_strings(frames = [])

          puts "broker received #{frames}" if LOG_BROKER_INFO<commit_msg>the broker helper should use bind<commit_after>require 'ffi-rzmq'
require 'msgpack'

module BrokerHelper

  LOG_BROKER_INFO = false

  def run_broker(endpoint)

    Thread.new do
      puts "broker running" if LOG_BROKER_INFO

      Thread.handle_interrupt(RuntimeError => :immediate) do

        begin
          context = ZMQ::Context.create
          socket = context.socket ZMQ::ROUTER
          socket.setsockopt(ZMQ::LINGER, 0)
          socket.bind(endpoint)
          puts "broker connected" if LOG_BROKER_INFO

          socket.recv_strings(frames = [])

          puts "broker received #{frames}" if LOG_BROKER_INFO
{'fraction_non_alphanumeric': 0.08123476848090982, 'fraction_numerical': 0.0016246953696181965, 'mean_word_length': 2.7791411042944785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5365395', 'n_tokens_mistral': 404, 'n_tokens_neox': 379, 'n_words': 86}