mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
removed tpds from settings.defaults.coffee, if not set updates are now not queued
This commit is contained in:
parent
56346ad88c
commit
8020cd8f47
3 changed files with 40 additions and 13 deletions
|
@ -15,10 +15,15 @@ buildPath = (user_id, project_name, filePath)->
|
|||
|
||||
|
||||
|
||||
tpdsworkerEnabled = -> settings.apis.tpdsworker?.url?
|
||||
if !tpdsworkerEnabled()
|
||||
logger.log "tpdsworker is not enabled, request will not be sent to it"
|
||||
|
||||
module.exports = TpdsUpdateSender =
|
||||
|
||||
_enqueue: (group, method, job, callback)->
|
||||
if !tpdsworkerEnabled()
|
||||
return callback()
|
||||
opts =
|
||||
uri:"#{settings.apis.tpdsworker.url}/enqueue/web_to_tpds_http_requests"
|
||||
json :
|
||||
|
|
|
@ -68,8 +68,6 @@ module.exports =
|
|||
thirdPartyDataStore:
|
||||
url : "http://localhost:3002"
|
||||
emptyProjectFlushDelayMiliseconds: 5 * seconds
|
||||
tpdsworker:
|
||||
url: "http://localhost:3030"
|
||||
tags:
|
||||
url :"http://localhost:3012"
|
||||
spelling:
|
||||
|
|
|
@ -23,20 +23,44 @@ describe 'TpdsUpdateSender', ->
|
|||
project = {owner_ref:user_id,readOnly_refs:[read_only_ref_1], collaberator_refs:[collaberator_ref_1]}
|
||||
@Project = findById:sinon.stub().callsArgWith(2, null, project)
|
||||
@docstoreUrl = "docstore.sharelatex.env"
|
||||
@request = sinon.stub().returns(pipe:->)
|
||||
@settings =
|
||||
siteUrl:siteUrl
|
||||
httpAuthSiteUrl:httpAuthSiteUrl,
|
||||
apis:
|
||||
thirdPartyDataStore: {url: thirdPartyDataStoreApiUrl}
|
||||
filestore:
|
||||
url: filestoreUrl
|
||||
docstore:
|
||||
pubUrl: @docstoreUrl
|
||||
@updateSender = SandboxedModule.require modulePath, requires:
|
||||
"settings-sharelatex":
|
||||
siteUrl:siteUrl
|
||||
httpAuthSiteUrl:httpAuthSiteUrl,
|
||||
apis:
|
||||
thirdPartyDataStore: {url: thirdPartyDataStoreApiUrl}
|
||||
filestore:
|
||||
url: filestoreUrl
|
||||
docstore:
|
||||
pubUrl: @docstoreUrl
|
||||
|
||||
"settings-sharelatex": @settings
|
||||
"logger-sharelatex":{log:->}
|
||||
'../../models/Project': Project:@Project
|
||||
'request':->{pipe:->}
|
||||
'request':@request
|
||||
|
||||
describe "_enqueue", ->
|
||||
|
||||
it "should not call request if there is no tpdsworker url", (done)->
|
||||
@updateSender._enqueue null, null, null, (err)=>
|
||||
@request.called.should.equal false
|
||||
done()
|
||||
|
||||
it "should post the message to the tpdsworker", (done)->
|
||||
@settings.apis.tpdsworker = url:"www.tpdsworker.env"
|
||||
group = "myproject"
|
||||
method = "somemethod"
|
||||
job = "do something"
|
||||
@request.callsArgWith(1)
|
||||
@updateSender._enqueue group, method, job, (err)=>
|
||||
args = @request.args[0][0]
|
||||
args.json.group.should.equal group
|
||||
args.json.job.should.equal job
|
||||
args.json.method.should.equal method
|
||||
args.uri.should.equal "www.tpdsworker.env/enqueue/web_to_tpds_http_requests"
|
||||
done()
|
||||
|
||||
|
||||
|
||||
describe 'sending updates', ->
|
||||
|
||||
|
|
Loading…
Reference in a new issue