<commit_before>/*
    This process listens for ipc messages on socket
    which are sent be main application and generate
    questions for a contest

    New requests are inserted into queue and processed
    one by one
 */

const util = require('./lib/util');
const ipc = require('node-ipc');
const crypto = require('crypto');
const generateGrid = require('./cubeGeneration/algo');
const contestService = require('./lib/services/contestService');
const questionService = require('./lib/services/questionService');
const dictionaryService = require('./lib/services/dictionaryService');
const MAX_WORDS_IN_GRID = 5;
const SLEEP_TIME = 10000; // Queue is checked every 5 seconds if empty
const GRID_ROWS = 5;
const GRID_COLS = GRID_ROWS * 4;

class Queue {
	constructor() {
		this.array = [];
	}

	push(contestId) {
		this.array.push(contestId);
		return true;
	}

	pop() {
		if(this.array.length) {
			return this.array.shift();
		}
		return null;
	}
}

let queue = new Queue();

ipc.config.id = 'generateProcess';
ipc.config.retry = 15000;

ipc.serve(() => {
	ipc.server.on(
		'app.message', (data, socket) => {<commit_msg>Reduced number of bonus on a grid<commit_after>/*
    This process listens for ipc messages on socket
    which are sent be main application and generate
    questions for a contest

    New requests are inserted into queue and processed
    one by one
 */

const util = require('./lib/util');
const ipc = require('node-ipc');
const crypto = require('crypto');
const generateGrid = require('./cubeGeneration/algo');
const contestService = require('./lib/services/contestService');
const questionService = require('./lib/services/questionService');
const dictionaryService = require('./lib/services/dictionaryService');
const MAX_WORDS_IN_GRID = 2;
const SLEEP_TIME = 10000; // Queue is checked every 5 seconds if empty
const GRID_ROWS = 5;
const GRID_COLS = GRID_ROWS * 4;

class Queue {
	constructor() {
		this.array = [];
	}

	push(contestId) {
		this.array.push(contestId);
		return true;
	}

	pop() {
		if(this.array.length) {
			return this.array.shift();
		}
		return null;
	}
}

let queue = new Queue();

ipc.config.id = 'generateProcess';
ipc.config.retry = 15000;

ipc.serve(() => {
	ipc.server.on(
		'app.message', (data, socket) => {
{'fraction_non_alphanumeric': 0.13227513227513227, 'fraction_numerical': 0.012345679012345678, 'mean_word_length': 3.986813186813187, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2845629', 'n_tokens_mistral': 770, 'n_tokens_neox': 717, 'n_words': 208}