1
1
import { Asset } from '../../../types' ;
2
2
import axios , { AxiosResponse } from 'axios' ;
3
3
import log from '../../../logger' ;
4
+ import { sleep } from '../../utils' ;
4
5
5
6
interface IdMapValue {
6
7
strategy : string ;
@@ -34,14 +35,6 @@ export default class ScimHandler {
34
35
this . idMap = new Map < string , IdMapValue > ( ) ;
35
36
}
36
37
37
- async wait ( duration : number = 200 ) {
38
- return new Promise ( ( resolve ) => {
39
- setTimeout ( ( ) => {
40
- resolve ( true ) ;
41
- } , duration ) ;
42
- } ) ;
43
- }
44
-
45
38
/**
46
39
* Check if the connection strategy is SCIM supported.
47
40
* Only few of the enterprise connections are SCIM supported.
@@ -70,7 +63,7 @@ export default class ScimHandler {
70
63
71
64
// To avoid rate limiter error, we making API requests with a small delay.
72
65
// TODO: However, this logic needs to be re-worked.
73
- await this . wait ( 500 ) ;
66
+ await sleep ( 500 ) ;
74
67
} catch ( err ) {
75
68
// Skip the connection if it returns 404. This can happen if `SCIM` is not enabled on a `SCIM` connection.
76
69
if ( err !== 'SCIM_NOT_FOUND' ) throw err ;
@@ -96,7 +89,7 @@ export default class ScimHandler {
96
89
97
90
// To avoid rate limiter error, we making API requests with a small delay.
98
91
// TODO: However, this logic needs to be re-worked.
99
- await this . wait ( 500 ) ;
92
+ await sleep ( 500 ) ;
100
93
} catch ( err ) {
101
94
// Skip the connection if it returns 404. This can happen if `SCIM` is not enabled on a `SCIM` connection.
102
95
if ( err !== 'SCIM_NOT_FOUND' ) throw err ;
0 commit comments