Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@
"archiveTweets": "# I'm downloading HTML copies of your tweets, starting with the oldest.\n\nThis may take a while...",
"conversations": "# I'm saving your direct message conversations.\n\nHang on while I scroll down to your earliest direct message conversations...",
"messages": "# I'm saving your direct messages.\n\nPlease wait while I index all the messages from each conversation...",
"messagesTimeoutError": "Unable to load a conversation. This appears to be an issue on X's side. The conversation will be skipped. You can try again later if needed.",
"likes": "# I'm saving your likes.\n\nHang on while I scroll down to your earliest likes.",
"bookmarks": "# I'm saving your bookmarks.\n\nHang on while I scroll down to your earliest bookmarks."
},
Expand Down
28 changes: 19 additions & 9 deletions src/renderer/src/view_models/XViewModel/jobs_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,7 @@ export async function runJobIndexMessages(vm: XViewModel, jobIndex: number) {
navigator.userAgent,
);

let tries: number,
success: boolean,
error: null | Error = null;
let tries: number, success: boolean;

let indexMessagesStartResponse: XIndexMessagesStartResponse;
let url = "";
Expand Down Expand Up @@ -409,7 +407,13 @@ export async function runJobIndexMessages(vm: XViewModel, jobIndex: number) {
try {
url = `https://x.com/messages/${indexMessagesStartResponse.conversationIDs[i]}`;
await vm.loadURLWithRateLimit(url);
await vm.waitForSelector('div[data-testid="DmActivityContainer"]', url);
// Use longer timeout on retries (60 seconds instead of default 30 seconds)
const timeout = tries > 0 ? 60000 : undefined;
await vm.waitForSelector(
'div[data-testid="DmActivityContainer"]',
url,
timeout,
);
success = true;
break;
} catch (e) {
Expand All @@ -422,7 +426,6 @@ export async function runJobIndexMessages(vm: XViewModel, jobIndex: number) {
if (vm.rateLimitInfo.isRateLimited) {
await vm.waitForRateLimit();
} else {
error = e;
vm.log("runJobIndexMessages", [
"loading conversation and waiting for messages failed, try #",
tries,
Expand All @@ -446,7 +449,6 @@ export async function runJobIndexMessages(vm: XViewModel, jobIndex: number) {
);
break;
} else {
error = e as Error;
vm.log("runJobIndexMessages", [
"loading conversation and waiting for messages failed, try #",
tries,
Expand All @@ -457,9 +459,17 @@ export async function runJobIndexMessages(vm: XViewModel, jobIndex: number) {
}

if (!success) {
await vm.error(AutomationErrorType.x_runJob_indexMessages_Timeout, {
error: formatError(error as Error),
});
// Instead of submitting an error report, show a user-friendly message
// and skip this conversation for now.
await window.electron.showError(
vm.t("viewModels.x.jobs.index.messagesTimeoutError"),
);
vm.log("runJobIndexMessages", [
"conversation timed out after 3 retries, skipping it",
]);
vm.progress.conversationMessagesIndexed += 1;
await vm.syncProgress();
shouldSkip = true;
}

if (shouldSkip) {
Expand Down
Loading