This commit is contained in:
Henry Oswald 2016-12-13 09:14:31 +00:00
commit 33df3346f8
6 changed files with 1947 additions and 5 deletions

View file

@ -1,6 +1,9 @@
Settings = require 'settings-sharelatex'
logger = require 'logger-sharelatex'
logger.initialize("spelling-sharelatex")
if Settings.sentry?.dsn?
logger.initializeErrorReporting(Settings.sentry.dsn)
SpellingAPIController = require './app/js/SpellingAPIController'
express = require('express')
Path = require("path")

View file

@ -41,8 +41,11 @@ class ASpellWorker
output = output + chunk
# We receive the language code from Aspell as the end of data marker
if chunk.toString().match(endMarker)
if @callback?
@callback(null, output.slice())
@callback = null # only allow one callback in use
else
logger.err process: @pipe.pid, lang: @language, "end of data marker received when callback already used"
@state = 'ready'
output = ""
error = ""

View file

@ -37,7 +37,6 @@ class ASpellWorkerPool
metrics.gauge 'aspellWorkerPool-size', @PROCESS_POOL.length
check: (language, words, timeout, callback) ->
logger.log lang: language, words: words.length, timeout: timeout, "aspell worker running check"
# look for an existing process in the pool
availableWorker = _.find @PROCESS_POOL, (cached) ->
cached.language == language && cached.isReady()

View file

@ -17,7 +17,6 @@ module.exports = LearnedWordsManager =
getLearnedWords: (user_token, callback = (error, words)->) ->
mongoCachedWords = mongoCache.get(user_token)
if mongoCachedWords?
logger.info user_token:user_token, "mongoCache hit"
metrics.inc "mongoCache-hit", 0.1
return callback(null, mongoCachedWords)

1938
services/spelling/npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,7 @@
"express": "^4.12.1",
"logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.1.0",
"lru-cache": "^4.0.0",
"metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#v1.3.0",
"metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#v1.5.0",
"mongojs": "1.3.0",
"node-statsd": "0.0.3",
"redis": "~0.8.4",