Compare commits

...

4 Commits

Author SHA1 Message Date
Gitea Actions
458588a6e7 ci: Bump version to 0.6.5 [skip ci] 2025-12-31 11:34:23 +05:00
0b4113417f flyer upload (anon) issues
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 11m56s
2025-12-30 22:33:55 -08:00
Gitea Actions
b59d2a9533 ci: Bump version to 0.6.4 [skip ci] 2025-12-31 11:11:53 +05:00
6740b35f8a flyer upload (anon) issues
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 11m52s
2025-12-30 22:11:21 -08:00
5 changed files with 8 additions and 6 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "flyer-crawler",
"version": "0.6.3",
"version": "0.6.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "flyer-crawler",
"version": "0.6.3",
"version": "0.6.5",
"dependencies": {
"@bull-board/api": "^6.14.2",
"@bull-board/express": "^6.14.2",

View File

@@ -1,7 +1,7 @@
{
"name": "flyer-crawler",
"private": true,
"version": "0.6.3",
"version": "0.6.5",
"type": "module",
"scripts": {
"dev": "concurrently \"npm:start:dev\" \"vite\"",

View File

@@ -106,7 +106,10 @@ export const useFlyerUploader = () => {
// Consolidate state derivation for the UI from the react-query hooks using useMemo.
// This improves performance by memoizing the derived state and makes the logic easier to follow.
const { processingState, errorMessage, duplicateFlyerId, flyerId, statusMessage } = useMemo(() => {
// The order of these checks is critical. Errors must be checked first to override
// any stale `jobStatus` from a previous successful poll.
const state: ProcessingState = (() => {
if (uploadMutation.isError || pollError) return 'error';
if (uploadMutation.isPending) return 'uploading';
if (jobStatus && (jobStatus.state === 'active' || jobStatus.state === 'waiting'))
return 'polling';
@@ -114,7 +117,6 @@ export const useFlyerUploader = () => {
if (!jobStatus.returnValue?.flyerId) return 'error';
return 'completed';
}
if (uploadMutation.isError || jobStatus?.state === 'failed' || pollError) return 'error';
return 'idle';
})();

View File

@@ -82,6 +82,7 @@ describe('Flyer Processing Background Job Integration Test', () => {
let jobStatus;
const maxRetries = 30; // Poll for up to 90 seconds (30 * 3s)
for (let i = 0; i < maxRetries; i++) {
console.log(`Polling attempt ${i + 1}...`);
await new Promise((resolve) => setTimeout(resolve, 3000)); // Wait 3 seconds between polls
const statusReq = request.get(`/api/ai/jobs/${jobId}/status`);
if (token) {
@@ -89,6 +90,7 @@ describe('Flyer Processing Background Job Integration Test', () => {
}
const statusResponse = await statusReq;
jobStatus = statusResponse.body;
console.log(`Job status: ${JSON.stringify(jobStatus)}`);
if (jobStatus.state === 'completed' || jobStatus.state === 'failed') {
break;
}

View File

@@ -43,8 +43,6 @@ export const cleanupDb = async (ids: TestResourceIds) => {
await pool.query('DELETE FROM public.user_watched_items WHERE user_id = ANY($1::uuid[])', [userIds]);
await pool.query('DELETE FROM public.user_achievements WHERE user_id = ANY($1::uuid[])', [userIds]);
await pool.query('DELETE FROM public.activity_log WHERE user_id = ANY($1::uuid[])', [userIds]);
await pool.query('DELETE FROM public.user_refresh_tokens WHERE user_id = ANY($1::uuid[])', [userIds]);
await pool.query('DELETE FROM public.password_reset_tokens WHERE user_id = ANY($1::uuid[])', [userIds]);
}
// --- Stage 2: Delete parent records that other things depend on ---