Skip to content

Commit

Permalink
Clear cache on any 401 response errors (opensearch-project#1634)
Browse files Browse the repository at this point in the history
* fixes clear cache on 401/403

Signed-off-by: Shenoy Pratik <[email protected]>

* remove 403 check

Signed-off-by: Shenoy Pratik <[email protected]>

---------

Signed-off-by: Shenoy Pratik <[email protected]>
(cherry picked from commit ce4d69f)
  • Loading branch information
ps48 authored and A9 Swift Project User committed Apr 9, 2024
1 parent 8f01676 commit a407b21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions auto_sync_commit_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"last_github_commit": "0e6dd629b3cefcbe185530a6cc47f58e7c28757e",
"last_gitfarm_commit": "7f0f7bab2f10356dc93823855ddc9c4ba454410c"
"last_github_commit": "ce4d69fc9a6973ac3232b8b58462d8b7feb1dd94",
"last_gitfarm_commit": "c058e85f97afe6d19869bc73c65a7a3ac202a2a5"
}
6 changes: 1 addition & 5 deletions public/framework/catalog_cache/cache_intercept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ import {
HttpInterceptorResponseError,
IHttpInterceptController,
} from '../../../../../src/core/public';
import { SECURITY_PLUGIN_ACCOUNT_API } from '../../../common/constants/shared';
import { CatalogCacheManager } from './cache_manager';

export function catalogCacheInterceptError(): any {
return (httpErrorResponse: HttpInterceptorResponseError, _: IHttpInterceptController) => {
if (
httpErrorResponse.response?.status === 401 &&
httpErrorResponse.fetchOptions.path === SECURITY_PLUGIN_ACCOUNT_API
) {
if (httpErrorResponse.response?.status === 401) {
// Clears all user catalog cache details
CatalogCacheManager.clearDataSourceCache();
CatalogCacheManager.clearAccelerationsCache();
Expand Down

0 comments on commit a407b21

Please sign in to comment.