Tweak outdated page behavior/function timeouts

This commit is contained in:
Sam Becker 2024-06-17 09:31:03 -05:00
parent 61d2039d6a
commit 791d020c94
3 changed files with 12 additions and 3 deletions

View File

@ -50,11 +50,16 @@ export default function AdminOutdatedClient({
const photosToSync = photos
.slice(0, UPDATE_BATCH_SIZE)
.map(photo => photo.id);
const isFinalBatch = photosToSync.length >= photos.length;
setPhotoIdsSyncing(photosToSync);
syncPhotosAction(photosToSync)
.finally(() => {
setPhotoIdsSyncing([]);
router.refresh();
if (isFinalBatch) {
router.push(PATH_ADMIN_PHOTOS);
} else {
setPhotoIdsSyncing([]);
router.refresh();
}
});
}
}}
@ -78,7 +83,7 @@ export default function AdminOutdatedClient({
{photos.length}
{' '}
{photos.length === 1 ? 'photo' : 'photos'}
{' ('}uploaded before
{' ('}last updated before
{' '}
{new Date(OUTDATED_THRESHOLD).toLocaleDateString()}{')'}
{' '}

View File

@ -3,6 +3,8 @@ import { OUTDATED_THRESHOLD } from '@/photo';
import AdminOutdatedClient from '@/admin/AdminOutdatedClient';
import { AI_TEXT_GENERATION_ENABLED } from '@/site/config';
export const maxDuration = 60;
export default async function AdminOutdatedPage() {
const photos = await getPhotos({
hidden: 'include',

View File

@ -5,6 +5,8 @@ import { OUTDATED_THRESHOLD } from '@/photo';
import AdminPhotosClient from '@/admin/AdminPhotosClient';
import { revalidatePath } from 'next/cache';
export const maxDuration = 60;
const DEBUG_PHOTO_BLOBS = false;
const INFINITE_SCROLL_INITIAL_ADMIN_PHOTOS = 25;