Skip to content

Commit 3e218c0

Browse files
committed
Using built-in "sleep" method. | Using 2 space indentation
1 parent c5fb632 commit 3e218c0

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/tools/auth0/handlers/scimHandler.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Asset } from '../../../types';
22
import axios, { AxiosResponse } from 'axios';
33
import log from '../../../logger';
4+
import { sleep } from '../../utils';
45

56
interface IdMapValue {
67
strategy: string;
@@ -34,14 +35,6 @@ export default class ScimHandler {
3435
this.idMap = new Map<string, IdMapValue>();
3536
}
3637

37-
async wait (duration: number = 200) {
38-
return new Promise((resolve) => {
39-
setTimeout(() => {
40-
resolve(true);
41-
}, duration);
42-
});
43-
}
44-
4538
/**
4639
* Check if the connection strategy is SCIM supported.
4740
* Only few of the enterprise connections are SCIM supported.
@@ -70,7 +63,7 @@ export default class ScimHandler {
7063

7164
// To avoid rate limiter error, we making API requests with a small delay.
7265
// TODO: However, this logic needs to be re-worked.
73-
await this.wait(500);
66+
await sleep(500);
7467
} catch (err) {
7568
// Skip the connection if it returns 404. This can happen if `SCIM` is not enabled on a `SCIM` connection.
7669
if (err !== 'SCIM_NOT_FOUND') throw err;
@@ -96,7 +89,7 @@ export default class ScimHandler {
9689

9790
// To avoid rate limiter error, we making API requests with a small delay.
9891
// TODO: However, this logic needs to be re-worked.
99-
await this.wait(500);
92+
await sleep(500);
10093
} catch (err) {
10194
// Skip the connection if it returns 404. This can happen if `SCIM` is not enabled on a `SCIM` connection.
10295
if (err !== 'SCIM_NOT_FOUND') throw err;

0 commit comments

Comments
 (0)