gmail sync: don't retry on overquota, import what we have

- OVERQUOTA from Gmail now continues to import step instead of retrying
- partial sync completion email tells user to try again in a few hours
- engine syncs handler meta to job on completion for richer notifications

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-02 20:00:45 +00:00
co-authored by Claude Opus 4.6
parent 583580eb10
commit de1baa1588
3 changed files with 48 additions and 17 deletions
+27 -7
View File
@@ -2,19 +2,39 @@ import Layout from 'emailer/emails/layouts/MainLayout.jsx';
import { Container, Text } from '@react-email/components';
type JobEmailData = {
job: { type: string; completedAt?: number };
job: { type: string; completedAt?: number; meta?: { gmailSyncPartial?: boolean; gmailSyncEmailCount?: number } };
};
const Email = ({ job }: JobEmailData) => {
const isPartialGmail = job?.type === 'gmail-sync' && job.meta?.gmailSyncPartial;
return (
<Layout>
<Container>
<Text className="pt-4 text-2xl">Job Completed</Text>
<Text>
{job?.type === 'gmail-sync'
? 'Your Google account is now completely synced.'
: `Your ${job?.type ?? 'unknown'} job has finished successfully.`}
</Text>
<Text className="pt-4 text-2xl">{isPartialGmail ? 'Gmail Sync Paused' : 'Job Completed'}</Text>
{job?.type === 'gmail-sync' ? (
isPartialGmail ? (
<>
<Text>
Gmail throttled the connection after downloading too many emails at once. This is normal for large
mailboxes your emails have been imported successfully.
</Text>
{job.meta?.gmailSyncEmailCount ? (
<Text className="text-sm text-gray-600">
{job.meta.gmailSyncEmailCount.toLocaleString()} emails downloaded so far.
</Text>
) : null}
<Text className="text-sm text-gray-600">
Wait a few hours and run the sync again to continue downloading the rest. It will pick up where it left
off.
</Text>
</>
) : (
<Text>Your Google account is now completely synced.</Text>
)
) : (
<Text>Your {job?.type ?? 'unknown'} job has finished successfully.</Text>
)}
</Container>
</Layout>
);