diff --git a/FrontEnd/src/components/Search/components/SearchInput/SearchInput.js b/FrontEnd/src/components/Search/components/SearchInput/SearchInput.js index b22503f..39ec86f 100644 --- a/FrontEnd/src/components/Search/components/SearchInput/SearchInput.js +++ b/FrontEnd/src/components/Search/components/SearchInput/SearchInput.js @@ -7,8 +7,6 @@ import MediaQuery from 'react-responsive' import classes from './SearchInput.scss' class SearchInput extends Component { - static timeoutId = null - componentDidMount() { this.refs.search_input.focus() } @@ -34,7 +32,7 @@ class SearchInput extends Component { search(0, query)} />
- { if (event.charCode === 13) { search(0, query) return } }} - onKeyDown={(event) => { - clearTimeout(this.timeoutId) - }} onChange={(event, newValue) => { - clearTimeout(this.timeoutId) setQuery(newValue) - - this.timeoutId = setTimeout(() => { - search(0, newValue) - }, 500) - }} - underlineShow={false} + }} + underlineShow={false} />
diff --git a/FrontEnd/src/index.html b/FrontEnd/src/index.html index bb4f708..847811c 100644 --- a/FrontEnd/src/index.html +++ b/FrontEnd/src/index.html @@ -1,9 +1,10 @@ + Loading... - + @@ -11,15 +12,11 @@ - - - - + + -
+
- + + \ No newline at end of file diff --git a/FrontEnd/src/routes/CoreLayout/modules/CoreLayout.js b/FrontEnd/src/routes/CoreLayout/modules/CoreLayout.js index 51415ab..f1aec83 100644 --- a/FrontEnd/src/routes/CoreLayout/modules/CoreLayout.js +++ b/FrontEnd/src/routes/CoreLayout/modules/CoreLayout.js @@ -1,4 +1,4 @@ -import { titles, stateValueExtractor, urls, constants, analytics } from 'utils' +import { titles, stateValueExtractor, urls, constants } from 'utils' import 'whatwg-fetch' const CHANGE_FIELD = 'CORE.CHANGE_FIELD' @@ -22,10 +22,7 @@ export const loadConfig = () => { const urls = stateValueExtractor.getUrls(getState()) dispatch(changeField('version', apiInfo.version)) - dispatch(changeField('lang', apiInfo.uiLang)) - - analytics(apiInfo.analyticsToken) - analytics().register({ apiUrl: urls.apiHost }) + dispatch(changeField('lang', apiInfo.uiLang)) }) .then(() => dispatch(stopLoadingIndicator())) @@ -56,7 +53,10 @@ const stopLoadingIndicator = () => { const getApiUrl = () => new Promise((resolve, reject) => { fetch('apiUrl.txt', { - method: 'GET' + method: 'GET', + mode: 'cors', + credentials: 'include', + cache: 'no-cache' }) .then(resp => resolve(resp.text())) .catch(err => reject(err)) @@ -64,7 +64,10 @@ const getApiUrl = () => new Promise((resolve, reject) => { const getLocalizationsJson = () => new Promise((resolve, reject) => { fetch('localizations.json', { - method: 'GET' + method: 'GET', + mode: 'cors', + credentials: 'include', + cache: 'no-cache' }) .then(resp => resolve(resp.text())) .catch(err => reject(err)) @@ -72,7 +75,10 @@ const getLocalizationsJson = () => new Promise((resolve, reject) => { const getWebApiInfo = (url) => new Promise((resolve, reject) => { fetch(url, { - method: 'GET' + method: 'GET', + mode: 'cors', + credentials: 'include', + cache: 'no-cache' }) .then(resp => resolve(resp.json())) .catch(err => reject(err)) @@ -88,8 +94,7 @@ export function showInfo(message) { export function handleError(error, showErrorMessage = false) { if (error.constructor === Response) { error = `Response ${error.status} ${error.statusText} at ${error.url}` - } - analytics().event('ERROR', { description: error ? error.toString() : 'no info' }) + } console.log(error) return { diff --git a/FrontEnd/src/routes/MainLayout/modules/MainLayout.js b/FrontEnd/src/routes/MainLayout/modules/MainLayout.js index 4c9d993..f1d4e3e 100644 --- a/FrontEnd/src/routes/MainLayout/modules/MainLayout.js +++ b/FrontEnd/src/routes/MainLayout/modules/MainLayout.js @@ -1,4 +1,4 @@ -import { urls, titles, stateValueExtractor, analytics } from 'utils' +import { urls, titles, stateValueExtractor } from 'utils' import { push } from 'react-router-redux' import { handleError } from 'routes/CoreLayout/modules/CoreLayout' @@ -43,8 +43,7 @@ export function stopLoadingIndicator() { export const toggleRateUsModal = (value) => { return (dispatch, getState) => { - dispatch(changeField('showRateUsModal', value)) - analytics().event('ACCOUNT.RATE_US_MODAL_OPENED') + dispatch(changeField('showRateUsModal', value)) } } diff --git a/FrontEnd/src/routes/SearchPage/modules/DetailedView.js b/FrontEnd/src/routes/SearchPage/modules/DetailedView.js index 49f4df9..53f27bf 100644 --- a/FrontEnd/src/routes/SearchPage/modules/DetailedView.js +++ b/FrontEnd/src/routes/SearchPage/modules/DetailedView.js @@ -1,6 +1,5 @@ import { stateValueExtractor } from 'utils/' import { hitsModel } from 'models/' -import { analytics } from 'utils' import { handleError } from 'routes/CoreLayout/modules/CoreLayout' import { startLoadingIndicator, stopLoadingIndicator } from 'routes/MainLayout/modules/MainLayout' @@ -25,7 +24,6 @@ export const loadHighlight = (fileId, query) => { .then((resp) => { dispatch(setContentHighlight(fileId, hitsModel.contentHighlightFromApi(resp))) dispatch(startStopHighlightLoadingIndicator(fileId, false)) - analytics().event('SEARCH.LOAD_HIGHLIGHT') }) .catch((errorPayload) => { dispatch(startStopHighlightLoadingIndicator(fileId, false)) diff --git a/FrontEnd/src/routes/SearchPage/modules/FileVisibilityReducer.js b/FrontEnd/src/routes/SearchPage/modules/FileVisibilityReducer.js index 9346ef5..5c0ba36 100644 --- a/FrontEnd/src/routes/SearchPage/modules/FileVisibilityReducer.js +++ b/FrontEnd/src/routes/SearchPage/modules/FileVisibilityReducer.js @@ -1,4 +1,4 @@ -import { stateValueExtractor, analytics } from 'utils' +import { stateValueExtractor } from 'utils' import { hitsModel } from 'models/' import { handleError } from 'routes/CoreLayout/modules/CoreLayout' import { startLoadingIndicator, stopLoadingIndicator } from 'routes/MainLayout/modules/MainLayout' @@ -18,7 +18,6 @@ export const hideFile = (fileId) => { }) .then(resp => { if (resp.status == 200) { - analytics().event('FILE.HIDE') return } else { throw resp } @@ -43,7 +42,6 @@ export const showFile = (fileId) => { }) .then(resp => { if (resp.status == 200) { - analytics().event('FILE.SHOW') return } else { throw resp } diff --git a/FrontEnd/src/routes/SearchPage/modules/ImagePreview.js b/FrontEnd/src/routes/SearchPage/modules/ImagePreview.js index 725fe53..3202882 100644 --- a/FrontEnd/src/routes/SearchPage/modules/ImagePreview.js +++ b/FrontEnd/src/routes/SearchPage/modules/ImagePreview.js @@ -1,10 +1,6 @@ -import { analytics } from 'utils' - export const TOGGLE_IMAGE_PREVIEW_MODAL = 'IMAGE_PREVIEW.TOGGLE_IMAGE_PREVIEW_MODAL' export const toggleImagePreview = (imageUrl) => { - analytics().event('IMAGE_PREVIEW.TOGGLE_IMAGE_PREIVEW') - return { type: TOGGLE_IMAGE_PREVIEW_MODAL, imageUrl diff --git a/FrontEnd/src/routes/SearchPage/modules/SearchPage.js b/FrontEnd/src/routes/SearchPage/modules/SearchPage.js index e9160d6..803d353 100644 --- a/FrontEnd/src/routes/SearchPage/modules/SearchPage.js +++ b/FrontEnd/src/routes/SearchPage/modules/SearchPage.js @@ -1,4 +1,3 @@ -import { analytics } from 'utils' import { handleError } from 'routes/CoreLayout/modules/CoreLayout' import { search, updateQuery } from 'routes/SearchPage/modules/SearchReducer' diff --git a/FrontEnd/src/routes/SearchPage/modules/SearchReducer.js b/FrontEnd/src/routes/SearchPage/modules/SearchReducer.js index cb3dbca..706a872 100644 --- a/FrontEnd/src/routes/SearchPage/modules/SearchReducer.js +++ b/FrontEnd/src/routes/SearchPage/modules/SearchReducer.js @@ -1,4 +1,4 @@ -import { stateValueExtractor, constants, titles, analytics } from 'utils/' +import { stateValueExtractor, constants, titles } from 'utils/' import { hitsModel, folderHitsModel } from 'models/' import { handleError } from 'routes/CoreLayout/modules/CoreLayout' import { startLoadingIndicator, stopLoadingIndicator } from 'routes/MainLayout/modules/MainLayout' @@ -154,9 +154,7 @@ const performSearch = (page, query) => { const hasMore = (hits.size > 0) const clean = (page == 0) dispatch(stopLoadingIndicator()) - dispatch(fillHits(clean, hits, data.found, query, hasMore, page)) - - if (page === 0) { analytics().event('SEARCH.PERFORM', { query: query }) } + dispatch(fillHits(clean, hits, data.found, query, hasMore, page)) }) .catch((errorPayload) => { dispatch(stopLoadingIndicator()) diff --git a/FrontEnd/src/routes/SearchPage/modules/TagsReducer.js b/FrontEnd/src/routes/SearchPage/modules/TagsReducer.js index a534db6..c09eb9a 100644 --- a/FrontEnd/src/routes/SearchPage/modules/TagsReducer.js +++ b/FrontEnd/src/routes/SearchPage/modules/TagsReducer.js @@ -1,4 +1,4 @@ -import { stateValueExtractor, constants, analytics } from 'utils/' +import { stateValueExtractor, constants } from 'utils/' import { hitsModel } from 'models/' import { handleError } from 'routes/CoreLayout/modules/CoreLayout' import { startLoadingIndicator, stopLoadingIndicator } from 'routes/MainLayout/modules/MainLayout' @@ -52,8 +52,7 @@ export const addTagToFile = (fileId, tagType, tagName) => { }) .then(resp => { if (resp.status == 200 || resp.status == 201) { - dispatch(markTagAsCreated(fileId, tagType, tagName)) - analytics().event('TAGS.ADD', { name: tagName }) + dispatch(markTagAsCreated(fileId, tagType, tagName)) return resp.json() } else { throw resp } @@ -80,8 +79,7 @@ export const removeTagFromFile = (fileId, tagType, tagName) => { ...defaultSettings }) .then(resp => { - if (resp.status == 200) { - analytics().event('TAGS.REMOVED', { name: tagName }) + if (resp.status == 200) { return resp.json() } else { throw resp } diff --git a/FrontEnd/src/routes/SearchPage/modules/UploadModal.js b/FrontEnd/src/routes/SearchPage/modules/UploadModal.js index fb57759..4becce7 100644 --- a/FrontEnd/src/routes/SearchPage/modules/UploadModal.js +++ b/FrontEnd/src/routes/SearchPage/modules/UploadModal.js @@ -1,5 +1,5 @@ import { stateValueExtractor } from 'utils/' -import { analytics, FormDataPolyfill } from 'utils' +import { FormDataPolyfill } from 'utils' import { handleError, showInfo } from 'routes/CoreLayout/modules/CoreLayout' import 'whatwg-fetch' @@ -41,7 +41,6 @@ export const uploadFiles = () => { dispatch(toggleUploadModal()) dispatch(cleanFilesToUpload()) dispatch(showInfo('Files succesfully uploaded')) - analytics().event('SEARCH.UPLOAD_FILES', { count: uploadPromises.length }) }) .catch((errorPayload) => { dispatch(filesUploading(false)) @@ -50,7 +49,6 @@ export const uploadFiles = () => { dispatch(handleError('No free space left in your account', true)) } else { dispatch(handleError(errorPayload)) - analytics().event('SEARCH.UPLOAD_FILES_ERROR', { error: errorPayload }) } console.error('uploadFile', errorPayload) diff --git a/FrontEnd/src/utils/index.js b/FrontEnd/src/utils/index.js index f91e054..254ee1e 100644 --- a/FrontEnd/src/utils/index.js +++ b/FrontEnd/src/utils/index.js @@ -7,6 +7,5 @@ import * as stateValueExtractor from './stateValueExtractor' import * as titles from './titles' import * as constants from './constants' import FormDataPolyfill from './formDataPolyfill' -import analytics from './analytics' -export { validators, urls, dates, files, dom, stateValueExtractor, titles, constants, analytics, FormDataPolyfill } \ No newline at end of file +export { validators, urls, dates, files, dom, stateValueExtractor, titles, constants, FormDataPolyfill } \ No newline at end of file diff --git a/FrontEnd/src/utils/stateValueExtractor.js b/FrontEnd/src/utils/stateValueExtractor.js index ae9a130..db0e692 100644 --- a/FrontEnd/src/utils/stateValueExtractor.js +++ b/FrontEnd/src/utils/stateValueExtractor.js @@ -13,7 +13,8 @@ export const getLocalization = (state) => { export const getDefaultSettings = () => { return { mode: 'cors', - credentials: 'include', + credentials: 'include', + cache: 'no-cache', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', diff --git a/FrontEnd/src/utils/titles.js b/FrontEnd/src/utils/titles.js index d3a64f9..d4b537a 100644 --- a/FrontEnd/src/utils/titles.js +++ b/FrontEnd/src/utils/titles.js @@ -1,7 +1,3 @@ -import analytics from './analytics' - export const setPageTitle = (title) => { document.title = title - analytics().register({ title: title }) - analytics().event('LOCATION_CHANGED') } \ No newline at end of file diff --git a/LocalCrawler/src/index.js b/LocalCrawler/src/index.js index 98ec5ec..4a39424 100644 --- a/LocalCrawler/src/index.js +++ b/LocalCrawler/src/index.js @@ -9,13 +9,18 @@ import cluster from 'cluster' import 'babel-core/register' import 'idempotent-babel-polyfill' -import { FileWatchService, ApiProxy } from './services' +import { FileWatchService, ApiProxy, QueueProxy } from './services' let app = null if (cluster.isMaster) { ApiProxy.logData(config.name, 'info', 'API runs on master thread') ApiProxy.logData(config.name, 'info', 'Creating fork for the file-watcher process') - cluster.fork() + + const worker = cluster.fork() + worker.on('exit', () => { + ApiProxy.logData(config.name, 'error', 'Worker thread crashed') + process.exit(1) + }) app = express() app.server = http.createServer(app) @@ -34,16 +39,20 @@ if (cluster.isMaster) { app.server.listen(process.env.PORT || config.port) console.log(`Started API on ${app.server.address().address}:${app.server.address().port}`) - - } else { ApiProxy.logData(config.name, 'info', 'File-watcher runs on worker thread') - - FileWatchService.startWatch() - .catch(err => { - ApiProxy.logData(config.name, 'error', `Error: ${err}`) + + const rabbitErrorHandler = (error) => { + ApiProxy.logData(config.name, 'error', `Rabbit Error: ${error}`) process.exit(1) - }) + } + + QueueProxy.initRabbit(rabbitErrorHandler) + .then(() => FileWatchService.startWatch()) + .catch(err => { + ApiProxy.logData(config.name, 'error', `Error: ${err}`) + process.exit(1) + }) } export default app diff --git a/LocalCrawler/src/services/FileWatchService.js b/LocalCrawler/src/services/FileWatchService.js index d1a7520..f0bf5eb 100644 --- a/LocalCrawler/src/services/FileWatchService.js +++ b/LocalCrawler/src/services/FileWatchService.js @@ -8,24 +8,17 @@ import minimatch from 'minimatch' import * as ApiProxy from './ApiProxy' import * as QueueProxy from './QueueProxy' -export const startWatch = () => new Promise((resolve, reject) => { - QueueProxy.initRabbit() - .then(() => { - chokidar.watch(config.crawlPath, { usePolling: true, awaitWriteFinish: true }) - .on('error', error => { - ApiProxy.logData(config.name, 'error', `Chokidar error: ${error}`) - }) - .on('all', (event, pathToFile, stat) => { - if (event === 'add' || event === 'change' || event === 'unlink') { - addTask(event, pathToFile, stat) - } - }) +export const startWatch = () => { + chokidar.watch(config.crawlPath, { usePolling: true, awaitWriteFinish: true }) + .on('error', error => { + ApiProxy.logData(config.name, 'error', `Chokidar error: ${error}`) }) - .catch(err => { - ApiProxy.logData(config.name, 'error', `Error: ${err}`) - reject(err) - }) -}) + .on('all', (event, pathToFile, stat) => { + if (event === 'add' || event === 'change' || event === 'unlink') { + addTask(event, pathToFile, stat) + } + }) +} const shouldIgnore = (pathToFile, stat) => { if (!stat) { @@ -70,7 +63,7 @@ const shouldIgnore = (pathToFile, stat) => { return false } -const addTask = (event, pathToFile, stat) => { +const addTask = (event, pathToFile, stat) => { let normalizedPath = path.normalize(pathToFile) normalizedPath = `//${normalizedPath.replace(config.crawlPath, config.name)}`.replace(/\\/g, '/') @@ -82,7 +75,7 @@ const addTask = (event, pathToFile, stat) => { const meta = { full_name: normalizedPath, updated_datetime: !stat ? '' : moment(stat.mtime).format('YYYY-MM-DD HH:mm:ss.SSS'), - created_datetime: !stat ? '' :moment(stat.atime).format('YYYY-MM-DD HH:mm:ss.SSS'), + created_datetime: !stat ? '' : moment(stat.atime).format('YYYY-MM-DD HH:mm:ss.SSS'), source_id: config.name, short_name: path.basename(normalizedPath), extension: path.extname(normalizedPath), diff --git a/LocalCrawler/src/services/QueueProxy.js b/LocalCrawler/src/services/QueueProxy.js index 38f9288..53b7677 100644 --- a/LocalCrawler/src/services/QueueProxy.js +++ b/LocalCrawler/src/services/QueueProxy.js @@ -18,14 +18,10 @@ export const enqueueMessage = (message) => { channel.publish(AMBAR_PIPELINE_EXCHANGE, '', Buffer.from(JSON.stringify(message)), { priority: priority }) } -export const initRabbit = () => new Promise((resolve, reject) => { +export const initRabbit = (onError) => new Promise((resolve, reject) => { amqp.connect(`${config.rabbitHost}?heartbeat=0`) .then((conn) => { - conn.on('error', (err) => { - //eslint-disable-next-line no-console - console.error('Rabbit error!') - throw err - }) + conn.on('error', onError) return conn.createChannel() .then(ch => { diff --git a/LocalCrawler/src/services/index.js b/LocalCrawler/src/services/index.js index 014a5ad..84dbc5b 100644 --- a/LocalCrawler/src/services/index.js +++ b/LocalCrawler/src/services/index.js @@ -1,7 +1,9 @@ import * as ApiProxy from './ApiProxy' import * as FileWatchService from './FileWatchService' +import * as QueueProxy from './QueueProxy' export { ApiProxy, - FileWatchService + FileWatchService, + QueueProxy } \ No newline at end of file diff --git a/Pipeline/Dockerfile b/Pipeline/Dockerfile index 9ab7550..beb68ec 100644 --- a/Pipeline/Dockerfile +++ b/Pipeline/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3 +FROM python:3.6.6-stretch RUN apt-get update && apt-get install -y \ curl \ diff --git a/Pipeline/requirements.txt b/Pipeline/requirements.txt index 8d98a5b..1e30b49 100644 Binary files a/Pipeline/requirements.txt and b/Pipeline/requirements.txt differ diff --git a/Rabbit/Dockerfile b/Rabbit/Dockerfile index 52adabc..c4655ee 100644 --- a/Rabbit/Dockerfile +++ b/Rabbit/Dockerfile @@ -1,4 +1,4 @@ -FROM rabbitmq:3-management +FROM rabbitmq:3.6-management RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y curl @@ -7,6 +7,7 @@ ENV TZ=UTC RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone COPY rabbitmq.config /etc/rabbitmq/rabbitmq.config +RUN chmod 777 /etc/rabbitmq/rabbitmq.config HEALTHCHECK --interval=5s --timeout=30s --retries=50 \ CMD curl -f localhost:15672 || exit 1 diff --git a/Rabbit/rabbitmq.config b/Rabbit/rabbitmq.config index 35e2aa3..071021a 100644 --- a/Rabbit/rabbitmq.config +++ b/Rabbit/rabbitmq.config @@ -1,3 +1,3 @@ [ { rabbit, [ { loopback_users, [ ] }, { heartbeat, 0} ] } -]. +]. \ No newline at end of file diff --git a/ServiceApi/src/services/EsProxy/AmbarFileDataMapping.json b/ServiceApi/src/services/EsProxy/AmbarFileDataMapping.json index fabfb46..4416711 100644 --- a/ServiceApi/src/services/EsProxy/AmbarFileDataMapping.json +++ b/ServiceApi/src/services/EsProxy/AmbarFileDataMapping.json @@ -5,18 +5,21 @@ "index.mapper.dynamic": false, "analysis": { "char_filter": { - "russian_cf": { + "ambar_cf": { "type": "mapping", "mappings": [ "ё => е", "Ё => Е", - "Й => И", - "й => и", ": => \\u0020" ] } }, "filter": { + "russian_replace_i": { + "type": "pattern_replace", + "pattern": "й", + "replacement": "и" + }, "russian_stop": { "type": "stop", "stopwords": "_russian_" @@ -25,10 +28,6 @@ "type": "stemmer", "language": "russian" }, - "russian_stop_alt": { - "type": "stop", - "stopwords": "а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я,a,an,and,are,as,at,be,but,by,for,if,in,into,is,it,no,not,of,on,or,such,that,the,their,then,there,these,they,this,to,was,will,with" - }, "ambar_word_delimiter": { "type": "word_delimiter", "generate_word_parts": true, @@ -102,29 +101,18 @@ "lowercase" ] }, - "ambar_ru_old": { - "tokenizer": "standard", - "char_filter": [ - "russian_cf" - ], - "filter": [ - "lowercase", - "russian_stop", - "russian_stemmer", - "ambar_word_delimiter" - ] - }, "ambar_ru": { "tokenizer": "standard", "char_filter": [ - "russian_cf" + "ambar_cf" ], "filter": [ "lowercase", + "russian_stop", "russian_morphology", "english_morphology", - "russian_stop_alt", - "ambar_word_delimiter" + "ambar_word_delimiter", + "russian_replace_i" ] }, "ambar_en": { diff --git a/ServiceApi/src/services/QueueProxy.js b/ServiceApi/src/services/QueueProxy.js index 6935fd4..2a167dd 100644 --- a/ServiceApi/src/services/QueueProxy.js +++ b/ServiceApi/src/services/QueueProxy.js @@ -32,7 +32,7 @@ export const enqueuePipelineMessage = (storage, message) => new Promise((resolve }) export const initRabbit = new Promise((resolve, reject) => { - amqp.connect(`${config.rabbitHost}?heartbeat=60`) + amqp.connect(`${config.rabbitHost}?heartbeat=0`) .then((conn) => { conn.on('error', (err) => { //eslint-disable-next-line no-console @@ -45,9 +45,9 @@ export const initRabbit = new Promise((resolve, reject) => { .then(() => channel.assertExchange(AMBAR_PIPELINE_WAITING_EXCHANGE, 'fanout', { durable: false })) .then(() => channel.assertQueue(AMBAR_PIPELINE_QUEUE, - { durable: false, arguments: { 'x-dead-letter-exchange': AMBAR_PIPELINE_WAITING_EXCHANGE, 'x-max-priority': AMBAR_PIPELINE_QUEUE_MAX_PRIORITY } })) + { durable: false, arguments: { 'x-queue-mode': 'lazy', 'x-dead-letter-exchange': AMBAR_PIPELINE_WAITING_EXCHANGE, 'x-max-priority': AMBAR_PIPELINE_QUEUE_MAX_PRIORITY } })) .then(() => channel.assertQueue(AMBAR_PIPELINE_WAITING_QUEUE, - { durable: false, arguments: { 'x-dead-letter-exchange': AMBAR_PIPELINE_EXCHANGE, 'x-message-ttl': AMBAR_PIPELINE_WAITING_QUEUE_TTL } })) + { durable: false, arguments: { 'x-queue-mode': 'lazy', 'x-dead-letter-exchange': AMBAR_PIPELINE_EXCHANGE, 'x-message-ttl': AMBAR_PIPELINE_WAITING_QUEUE_TTL } })) .then(() => channel.bindQueue(AMBAR_PIPELINE_QUEUE, AMBAR_PIPELINE_EXCHANGE)) .then(() => channel.bindQueue(AMBAR_PIPELINE_WAITING_QUEUE, diff --git a/WebApi/package.json b/WebApi/package.json index 00d93c9..54c6de9 100644 --- a/WebApi/package.json +++ b/WebApi/package.json @@ -1,6 +1,6 @@ { "name": "ambar-webapi", - "version": "2.1.0", + "version": "2.1.18", "description": "Ambar WebAPI", "main": "dist", "scripts": { diff --git a/WebApi/src/api/index.js b/WebApi/src/api/index.js index c01cd0e..0b57465 100644 --- a/WebApi/src/api/index.js +++ b/WebApi/src/api/index.js @@ -19,8 +19,7 @@ export default ({ config, storage }) => { api.get('/', (req, res) => { res.json({ - version: version, - analyticsToken: config.analyticsToken, + version: version, uiLang: config.uiLang, rawConfig: config }) diff --git a/WebApi/src/config.js b/WebApi/src/config.js index d0eb3dc..32d0a24 100644 --- a/WebApi/src/config.js +++ b/WebApi/src/config.js @@ -11,8 +11,7 @@ const defaultConfig = { "apiUrl": "http://ambar:8080", "serviceApiUrl": "http://localhost:8081", "rabbitHost": "amqp://ambar", - "uiLang": "en", - "analyticsToken": "", + "uiLang": "en", "crawlerPort": 8082 } diff --git a/WebApi/src/services/QueueProxy.js b/WebApi/src/services/QueueProxy.js index dcac1bf..1e871ff 100644 --- a/WebApi/src/services/QueueProxy.js +++ b/WebApi/src/services/QueueProxy.js @@ -26,7 +26,7 @@ export const enqueuePipelineMessage = (storage, message) => new Promise((resolve }) export const initRabbit = new Promise((resolve, reject) => { - amqp.connect(`${config.rabbitHost}?heartbeat=60`) + amqp.connect(`${config.rabbitHost}?heartbeat=0`) .then((conn) => { conn.on('error', (err) => { //eslint-disable-next-line no-console