fix: handle deleted Google Tasks lists gracefully (404 cleanup)
When a Google Tasks list returns 404 during sync, soft-delete all local tasks linked to it and unlink the synced someday list instead of spamming error logs. v1.57.3 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ba19482a41
commit
87d78d78b5
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "my-weekly-todo-list",
|
||||
"version": "1.57.2",
|
||||
"version": "1.57.3",
|
||||
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@ -206,7 +206,20 @@ export async function GET(req: NextRequest) {
|
||||
}
|
||||
}
|
||||
} catch (listError: any) {
|
||||
if (listError?.code === 429 || listError?.status === 429) {
|
||||
if (listError?.code === 404 || listError?.status === 404) {
|
||||
console.warn(`Google Tasks list ${listId} not found (deleted?), cleaning up local references`);
|
||||
// Soft-delete local tasks linked to this deleted list
|
||||
const result = await prisma.task.updateMany({
|
||||
where: { userId: user.id, externalProvider: 'google', externalListId: listId, deletedAt: null },
|
||||
data: { deletedAt: new Date() },
|
||||
});
|
||||
deleted += result.count;
|
||||
// Unlink the synced someday list
|
||||
await prisma.somedayList.updateMany({
|
||||
where: { userId: user.id, externalProvider: 'google', externalId: listId },
|
||||
data: { externalId: null, externalProvider: null },
|
||||
});
|
||||
} else if (listError?.code === 429 || listError?.status === 429) {
|
||||
console.warn(`Google Tasks quota exceeded for list ${listId}, skipping`);
|
||||
} else {
|
||||
console.error(`Error syncing Google list ${listId}:`, listError);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user