This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Example of broker with worker cluster, you need this kind of architecture | |
when you have some gateway (API for example) with large amount of tasks (CPU tasks for example XML-string creation) | |
and want to delegate this tasks to workers (to improve speed of processing) without any additional brokers (kafka) usage. | |
*/ | |
const cluster = require('cluster'); | |
const express = require('express'); | |
const http = require('http'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Напишите функцию sum которая умеет складывать числа. Пример работы: | |
sum(1); // => console: 1 | |
sum(1)(2)(3); // => console: 1 3 6 | |
*/ | |
function sum(number) { | |
let counter = number; | |
console.log(counter); | |
return function a(number1) { |