mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
Merge pull request #33710 from overleaf/em-tpds-config
Clean up tpdsworker config from web and third-party-datastore GitOrigin-RevId: 3856126d9dc856fea4bc4133b11402c35b10630b
This commit is contained in:
@@ -4,7 +4,9 @@ import { fetchJson } from '@overleaf/fetch-utils'
|
||||
|
||||
async function getQueues(userId) {
|
||||
try {
|
||||
return await fetchJson(`${Settings.apis.tpdsworker.url}/queues/${userId}`)
|
||||
return await fetchJson(
|
||||
`${Settings.apis.thirdPartyDataStore.url}/queues/${userId}`
|
||||
)
|
||||
} catch (err) {
|
||||
throw OError.tag(err, 'failed to query TPDS queues for user', { userId })
|
||||
}
|
||||
|
||||
@@ -173,13 +173,12 @@ async function createProject(params) {
|
||||
}
|
||||
|
||||
async function enqueue(group, method, job) {
|
||||
const tpdsWorkerUrl = _.get(settings, ['apis', 'tpdsworker', 'url'])
|
||||
// silently do nothing if worker url is not in settings
|
||||
if (!tpdsWorkerUrl) {
|
||||
const enqueueBaseUrl = _.get(settings, ['apis', 'thirdPartyDataStore', 'url'])
|
||||
if (!enqueueBaseUrl) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const url = new URL('/enqueue/web_to_tpds_http_requests', tpdsWorkerUrl)
|
||||
const url = new URL('/enqueue/web_to_tpds_http_requests', enqueueBaseUrl)
|
||||
await fetchNothing(url, {
|
||||
method: 'POST',
|
||||
json: { group, job, method },
|
||||
@@ -187,7 +186,7 @@ async function enqueue(group, method, job) {
|
||||
})
|
||||
} catch (err) {
|
||||
// log error and continue
|
||||
logger.error({ err, group, job, method }, 'error enqueueing tpdsworker job')
|
||||
logger.error({ err, group, job, method }, 'error enqueueing tpds job')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,11 +33,6 @@ const overrides = {
|
||||
webhookPass: 'webhook',
|
||||
},
|
||||
|
||||
tpdsworker: {
|
||||
// Disable tpdsworker in CI.
|
||||
url: undefined,
|
||||
},
|
||||
|
||||
v1: {
|
||||
url: `http://127.0.0.1:25000`,
|
||||
user: 'overleaf',
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('TpdsUpdateSender', function () {
|
||||
}
|
||||
ctx.memberIds = [userId, collaberatorRef, readOnlyRef]
|
||||
ctx.enqueueUrl = new URL(
|
||||
'http://tpdsworker/enqueue/web_to_tpds_http_requests'
|
||||
`${thirdPartyDataStoreApiUrl}/enqueue/web_to_tpds_http_requests`
|
||||
)
|
||||
|
||||
ctx.CollaboratorsGetter = {
|
||||
@@ -101,13 +101,13 @@ describe('TpdsUpdateSender', function () {
|
||||
})
|
||||
|
||||
describe('enqueue', function () {
|
||||
it('should not call request if there is no tpdsworker url', async function (ctx) {
|
||||
it('should not call request if thirdPartyDataStore is not configured', async function (ctx) {
|
||||
delete ctx.settings.apis.thirdPartyDataStore
|
||||
await ctx.TpdsUpdateSender.promises.enqueue(null, null, null)
|
||||
ctx.FetchUtils.fetchNothing.should.not.have.been.called
|
||||
})
|
||||
|
||||
it('should post the message to the tpdsworker', async function (ctx) {
|
||||
ctx.settings.apis.tpdsworker = { url: 'http://tpdsworker' }
|
||||
it('should post the message to tpds', async function (ctx) {
|
||||
const group0 = 'myproject'
|
||||
const method0 = 'somemethod0'
|
||||
const job0 = 'do something'
|
||||
@@ -123,10 +123,6 @@ describe('TpdsUpdateSender', function () {
|
||||
})
|
||||
|
||||
describe('sending updates', function () {
|
||||
beforeEach(function (ctx) {
|
||||
ctx.settings.apis.tpdsworker = { url: 'http://tpdsworker' }
|
||||
})
|
||||
|
||||
it('queues a post the file with user and file id and hash', async function (ctx) {
|
||||
const fileId = '4545345'
|
||||
const hash = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
|
||||
Reference in New Issue
Block a user