[INT-API-004] Add request timeout configuration per endpoint type
This commit is contained in:
parent
c2af450fd5
commit
8d35484e14
4 changed files with 19 additions and 11 deletions
|
|
@ -531,7 +531,8 @@
|
|||
"description": "Configurer des timeouts différents pour uploads (long) vs requêtes normales.",
|
||||
"priority": "P2",
|
||||
"priority_rank": 15,
|
||||
"status": "todo",
|
||||
"status": "completed",
|
||||
"completed_at": "2025-01-27T15:15:00Z",
|
||||
"estimated_hours": 1,
|
||||
"side": "frontend_only",
|
||||
"files_to_modify": [
|
||||
|
|
@ -1096,13 +1097,13 @@
|
|||
},
|
||||
"progress_tracking": {
|
||||
"total_tasks": 32,
|
||||
"completed": 14,
|
||||
"completed": 15,
|
||||
"in_progress": 0,
|
||||
"todo": 18,
|
||||
"todo": 17,
|
||||
"blocked": 0,
|
||||
"completion_percentage": 44,
|
||||
"last_updated": "2025-01-27T15:00:00Z",
|
||||
"completion_percentage": 47,
|
||||
"last_updated": "2025-01-27T15:15:00Z",
|
||||
"estimated_completion_date": null,
|
||||
"estimated_hours_remaining": 27.5
|
||||
"estimated_hours_remaining": 26.5
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { apiClient } from '@/services/api/client';
|
||||
import { apiClient, API_TIMEOUTS } from '@/services/api/client';
|
||||
import { Track, TrackStatus } from '../types/track';
|
||||
import { AxiosError, AxiosProgressEvent } from 'axios';
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ export async function uploadTrack(
|
|||
onProgress(Math.min(uploadProgress * 0.2, 20));
|
||||
}
|
||||
},
|
||||
timeout: 300000, // 5 minutes timeout for large files
|
||||
timeout: API_TIMEOUTS.UPLOAD, // INT-API-004: Use standardized upload timeout (5 minutes)
|
||||
};
|
||||
|
||||
const response = await apiClient.post<Track | AsyncUploadResponse>(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { apiClient } from '@/services/api/client';
|
||||
import { apiClient, API_TIMEOUTS } from '@/services/api/client';
|
||||
import { Track, UploadProgress } from '../types/track';
|
||||
import { AxiosError, AxiosProgressEvent } from 'axios';
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ export async function uploadTrack(
|
|||
onProgress(progress);
|
||||
}
|
||||
},
|
||||
timeout: 300000, // 5 minutes timeout for large files
|
||||
timeout: API_TIMEOUTS.UPLOAD, // INT-API-004: Use standardized upload timeout (5 minutes)
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,17 @@ import type { ApiResponse } from '@/types/api';
|
|||
* Aligné avec FRONTEND_INTEGRATION.md
|
||||
*/
|
||||
|
||||
// INT-API-004: Timeout configurations per endpoint type
|
||||
export const API_TIMEOUTS = {
|
||||
DEFAULT: 10000, // 10 seconds - default timeout for normal requests
|
||||
UPLOAD: 300000, // 5 minutes - timeout for file uploads
|
||||
LONG_POLLING: 30000, // 30 seconds - timeout for long-polling requests
|
||||
} as const;
|
||||
|
||||
// Client API réutilisable
|
||||
export const apiClient = axios.create({
|
||||
baseURL: env.API_URL,
|
||||
timeout: 10000,
|
||||
timeout: API_TIMEOUTS.DEFAULT,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue