Merge pull request #17105 from overleaf/jpa-tpds-cleanup

[misc] cleanup for tpds queues

GitOrigin-RevId: 8a501a692fa20d8956ad9dc4fccc0447c9f6fbe5
This commit is contained in:
Jakob Ackermann 2024-02-16 10:30:31 +00:00 committed by Copybot
parent cdca83d94e
commit 4804cd68a5
3 changed files with 15 additions and 65 deletions

2
package-lock.json generated
View file

@ -46087,7 +46087,6 @@
"@overleaf/o-error": "*",
"@overleaf/redis-wrapper": "*",
"@overleaf/settings": "*",
"bluebird": "^3.7.2",
"body-parser": "^1.19.0",
"bunyan": "^1.8.15",
"dtrace-provider": "^0.8.8",
@ -54957,7 +54956,6 @@
"@overleaf/o-error": "*",
"@overleaf/redis-wrapper": "*",
"@overleaf/settings": "*",
"bluebird": "^3.7.2",
"body-parser": "^1.19.0",
"bunyan": "^1.8.15",
"chai": "^4.3.6",

View file

@ -55,8 +55,6 @@ async function addEntity(params) {
sl_entity_type: entityType,
sl_entity_rev: rev,
sl_project_id: projectId,
sl_all_user_ids: JSON.stringify([userId]),
sl_project_owner_user_id: projectUserIds[0],
sl_folder_id: folderId,
},
uri: buildTpdsUrl(userId, projectName, path),
@ -124,8 +122,6 @@ async function deleteEntity(params) {
method: 'delete',
headers: {
sl_project_id: projectId,
sl_all_user_ids: JSON.stringify([userId]),
sl_project_owner_user_id: projectUserIds[0],
sl_entity_id: entityId,
sl_entity_type: entityType,
},
@ -135,7 +131,6 @@ async function deleteEntity(params) {
// would be moved to a POST endpoint.
json: { subtreeEntityIds },
title: 'deleteEntity',
sl_all_user_ids: JSON.stringify([userId]),
}
await enqueue(userId, 'standardHttpRequest', job)
@ -145,14 +140,12 @@ async function deleteEntity(params) {
async function createProject(params) {
if (!tpdsUrl) return // Overleaf Community Edition/Server Pro
const { projectId, projectName, ownerId, userId } = params
const { projectId, projectName, userId } = params
const job = {
method: 'post',
headers: {
sl_project_id: projectId.toString(),
sl_all_user_ids: JSON.stringify([userId.toString()]),
sl_project_owner_user_id: ownerId.toString(),
},
uri: Path.join(
tpdsUrl,
@ -163,7 +156,6 @@ async function createProject(params) {
encodeURIComponent(projectName)
),
title: 'createProject',
sl_all_user_ids: JSON.stringify([userId]),
}
await enqueue(userId, 'standardHttpRequest', job)
@ -217,8 +209,6 @@ async function moveEntity(params) {
const headers = {
sl_project_id: projectId,
sl_entity_rev: rev,
sl_all_user_ids: JSON.stringify([userId]),
sl_project_owner_user_id: projectUserIds[0],
}
if (entityId != null) {
headers.sl_entity_id = entityId

View file

@ -134,10 +134,7 @@ describe('TpdsUpdateSender', function () {
uri: `${thirdPartyDataStoreApiUrl}/user/${userId}/entity/${encodeURIComponent(
projectName
)}${encodeURIComponent(path)}`,
headers: {
sl_all_user_ids: JSON.stringify([userId]),
sl_project_owner_user_id: userId,
},
headers: {},
},
},
}
@ -148,12 +145,6 @@ describe('TpdsUpdateSender', function () {
{
json: {
group: collaberatorRef,
job: {
headers: {
sl_all_user_ids: JSON.stringify([collaberatorRef]),
sl_project_owner_user_id: userId,
},
},
},
}
)
@ -163,12 +154,7 @@ describe('TpdsUpdateSender', function () {
{
json: {
group: readOnlyRef,
job: {
headers: {
sl_all_user_ids: JSON.stringify([readOnlyRef]),
sl_project_owner_user_id: userId,
},
},
job: {},
},
}
)
@ -199,9 +185,7 @@ describe('TpdsUpdateSender', function () {
projectName
)}${encodeURIComponent(path)}`,
streamOrigin: `${this.docstoreUrl}/project/${projectId}/doc/${docId}/raw`,
headers: {
sl_all_user_ids: JSON.stringify([userId]),
},
headers: {},
},
},
}
@ -213,9 +197,7 @@ describe('TpdsUpdateSender', function () {
json: {
group: collaberatorRef,
job: {
headers: {
sl_all_user_ids: JSON.stringify([collaberatorRef]),
},
headers: {},
},
},
}
@ -227,9 +209,7 @@ describe('TpdsUpdateSender', function () {
json: {
group: readOnlyRef,
job: {
headers: {
sl_all_user_ids: JSON.stringify([readOnlyRef]),
},
headers: {},
},
},
}
@ -258,9 +238,7 @@ describe('TpdsUpdateSender', function () {
uri: `${thirdPartyDataStoreApiUrl}/user/${userId}/entity/${encodeURIComponent(
projectName
)}${encodeURIComponent(path)}`,
headers: {
sl_all_user_ids: JSON.stringify([userId]),
},
headers: {},
json: { subtreeEntityIds },
},
},
@ -273,9 +251,7 @@ describe('TpdsUpdateSender', function () {
json: {
group: collaberatorRef,
job: {
headers: {
sl_all_user_ids: JSON.stringify([collaberatorRef]),
},
headers: {},
},
},
}
@ -287,9 +263,7 @@ describe('TpdsUpdateSender', function () {
json: {
group: readOnlyRef,
job: {
headers: {
sl_all_user_ids: JSON.stringify([readOnlyRef]),
},
headers: {},
},
},
}
@ -320,9 +294,7 @@ describe('TpdsUpdateSender', function () {
startPath: `/${projectName}/${startPath}`,
endPath: `/${projectName}/${endPath}`,
},
headers: {
sl_all_user_ids: JSON.stringify([userId]),
},
headers: {},
},
},
}
@ -334,9 +306,7 @@ describe('TpdsUpdateSender', function () {
json: {
group: collaberatorRef,
job: {
headers: {
sl_all_user_ids: JSON.stringify([collaberatorRef]),
},
headers: {},
},
},
}
@ -348,9 +318,7 @@ describe('TpdsUpdateSender', function () {
json: {
group: readOnlyRef,
job: {
headers: {
sl_all_user_ids: JSON.stringify([readOnlyRef]),
},
headers: {},
},
},
}
@ -380,9 +348,7 @@ describe('TpdsUpdateSender', function () {
startPath: oldProjectName,
endPath: newProjectName,
},
headers: {
sl_all_user_ids: JSON.stringify([userId]),
},
headers: {},
},
},
}
@ -394,9 +360,7 @@ describe('TpdsUpdateSender', function () {
json: {
group: collaberatorRef,
job: {
headers: {
sl_all_user_ids: JSON.stringify([collaberatorRef]),
},
headers: {},
},
},
}
@ -408,9 +372,7 @@ describe('TpdsUpdateSender', function () {
json: {
group: readOnlyRef,
job: {
headers: {
sl_all_user_ids: JSON.stringify([readOnlyRef]),
},
headers: {},
},
},
}