Skip to content

Commit

Permalink
Merge pull request #4544 from coralproject/hotfix/unarchiving-timeout
Browse files Browse the repository at this point in the history
Hotfix/unarchiving timeout
  • Loading branch information
nick-funk authored Feb 15, 2024
2 parents 5b5efb8 + 9758e54 commit 3b9f452
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coralproject/talk",
"version": "8.7.3",
"version": "8.7.4",
"author": "The Coral Project",
"homepage": "https://coralproject.net/",
"sideEffects": [
Expand Down
4 changes: 2 additions & 2 deletions common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "common",
"version": "8.7.3",
"version": "8.7.4",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions config/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "common",
"version": "8.7.3",
"version": "8.7.4",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coralproject/talk",
"version": "8.7.3",
"version": "8.7.4",
"author": "The Coral Project",
"homepage": "https://coralproject.net/",
"sideEffects": [
Expand Down
1 change: 1 addition & 0 deletions server/src/core/server/models/story/story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ export async function retrieveStoryToBeUnarchived(
},
{
returnOriginal: false,
maxTimeMS: 30 * 60 * 1000,
}
);

Expand Down
3 changes: 2 additions & 1 deletion server/src/core/server/queue/tasks/unarchiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const createJobProcessor = ({
throw new Error("unable to unarchive story");
}

log.debug({ took: timer() }, "attempted unarchive operation ended");
log.info({ storyID, took: timer() }, "attempted unarchive operation ended");
};
};

Expand All @@ -101,5 +101,6 @@ export function createUnarchiverTask(
jobIdGenerator: ({ tenantID, storyID }) =>
`${tenantID}:${storyID}:unarchive`,
attempts: 1,
timeout: 1 * 60 * 60 * 1000,
});
}
6 changes: 4 additions & 2 deletions server/src/core/server/services/archive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ export async function unarchiveStory(
const logger = log.child({ storyID: id });
logger.info("starting to unarchive story");

const targetStory = await mongo.stories().findOne({ id, tenantID });
const targetStory = await mongo
.stories()
.findOne({ id, tenantID }, { maxTimeMs: 30 * 60 * 1000 });
if (!targetStory) {
throw new StoryNotFoundError(id);
}
Expand Down Expand Up @@ -203,7 +205,7 @@ async function moveDocuments<T extends { id: string }>({
let deleteIDs: string[] = [];
const allIDs: string[] = [];

const selectionCursor = source.find(filter);
const selectionCursor = source.find(filter, { maxTimeMs: 30 * 60 * 1000 });

while (await selectionCursor.hasNext()) {
const document = await selectionCursor.next();
Expand Down

0 comments on commit 3b9f452

Please sign in to comment.