updates
This commit is contained in:
@@ -37,8 +37,8 @@ export const getInterestById = async (id: string) =>
|
||||
},
|
||||
});
|
||||
|
||||
export const updateInterest = async (id: string, data: Partial<Interest>) => {
|
||||
console.log('[nocodb.updateInterest] Updating interest:', id);
|
||||
export const updateInterest = async (id: string, data: Partial<Interest>, retryCount = 0): Promise<Interest> => {
|
||||
console.log('[nocodb.updateInterest] Updating interest:', id, 'Retry:', retryCount);
|
||||
console.log('[nocodb.updateInterest] Data fields:', Object.keys(data));
|
||||
|
||||
// Create a clean data object that matches the InterestsRequest schema
|
||||
@@ -110,12 +110,24 @@ export const updateInterest = async (id: string, data: Partial<Interest>) => {
|
||||
console.error('[nocodb.updateInterest] Update failed:', error);
|
||||
console.error('[nocodb.updateInterest] Error details:', error instanceof Error ? error.message : 'Unknown error');
|
||||
|
||||
// If it's a 404 error for a newly created record, provide more context
|
||||
// If it's a 404 error and we haven't retried too many times, wait and retry
|
||||
if ((error.statusCode === 404 || error.status === 404) && retryCount < 3) {
|
||||
console.error('[nocodb.updateInterest] 404 Error - Record not found. This might be a sync delay.');
|
||||
console.error(`Retrying in ${(retryCount + 1) * 1000}ms... (Attempt ${retryCount + 1}/3)`);
|
||||
|
||||
// Wait with exponential backoff
|
||||
await new Promise(resolve => setTimeout(resolve, (retryCount + 1) * 1000));
|
||||
|
||||
// Retry the update
|
||||
return updateInterest(id, data, retryCount + 1);
|
||||
}
|
||||
|
||||
// If it's still a 404 after retries, provide detailed error
|
||||
if (error.statusCode === 404 || error.status === 404) {
|
||||
console.error('[nocodb.updateInterest] 404 Error - Record not found. This might happen if:');
|
||||
console.error('[nocodb.updateInterest] 404 Error - Record not found after 3 retries. This might happen if:');
|
||||
console.error('1. The record ID is incorrect');
|
||||
console.error('2. The record was just created and is not yet available');
|
||||
console.error('3. The record was deleted');
|
||||
console.error('2. The record was deleted');
|
||||
console.error('3. There is a synchronization issue with the database');
|
||||
console.error('Attempted URL:', url);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user