mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
AAE-30358 Update Retry connection logic to allow retry when the graphql return unauthorized error
This commit is contained in:
parent
76999ee830
commit
10346dbf1f
@ -141,9 +141,25 @@ export class WebSocketService {
|
||||
max: Number.POSITIVE_INFINITY,
|
||||
jitter: true
|
||||
},
|
||||
attempts: {
|
||||
max: 5,
|
||||
retryIf: (error) => !!error
|
||||
attempts: (count: number, _operation: Operation, error: any) => {
|
||||
if (!error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const isUnauthorizedError =
|
||||
(Array.isArray(error) &&
|
||||
error.some(
|
||||
(err: any) =>
|
||||
err?.extensions?.code === 'UNAUTHORIZED' ||
|
||||
err?.message?.includes('4401') ||
|
||||
err?.message?.toLowerCase().includes('unauthorized')
|
||||
)) ||
|
||||
(typeof error === 'string' && (error.includes('4401') || error.toLowerCase().includes('unauthorized'))) ||
|
||||
(error?.message && (error.message.includes('4401') || error.message.toLowerCase().includes('unauthorized')));
|
||||
|
||||
const shouldRetry = isUnauthorizedError ? this.authService.isLoggedIn() : count < 5;
|
||||
|
||||
return shouldRetry;
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user