<commit_before>require 'base64'
require 'json'
require 'zlib'
require 'stringio'

class AgentListenerController < ApplicationController
  skip_before_action :verify_authenticity_token, :authenticate_user!

  def create
    params.permit!

    AppPerfAgentWorker.perform_later(params, request.body.read)

    render :text => "", :status => :ok
  end

  private

  def parse_body(request)
    request.body.rewind<commit_msg>rewind body before dispatching to worker<commit_after>require 'base64'
require 'json'
require 'zlib'
require 'stringio'

class AgentListenerController < ApplicationController
  skip_before_action :verify_authenticity_token, :authenticate_user!

  def create
    params.permit!

    request.body.rewind
    AppPerfAgentWorker.perform_later(params, request.body.read)

    render :text => "", :status => :ok
  end

  private

  def parse_body(request)
    request.body.rewind
{'fraction_non_alphanumeric': 0.08715083798882682, 'fraction_numerical': 0.004469273743016759, 'mean_word_length': 4.933774834437086, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5926594', 'n_tokens_mistral': 286, 'n_tokens_neox': 267, 'n_words': 61}