Remove unused timeout10()
This commit is contained in:
parent
6d3f9e9f01
commit
ae5cd44b74
1 changed files with 0 additions and 23 deletions
|
|
@ -24,29 +24,6 @@ const delay = ms => new Promise(res => setTimeout(res, ms))
|
|||
*/
|
||||
const mySecret = () => Promise.resolve(require('../../Mediator').getMySecret())
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {Promise<T>} promise
|
||||
* @returns {Promise<T>}
|
||||
*/
|
||||
const timeout10 = promise => {
|
||||
/** @type {NodeJS.Timeout} */
|
||||
// @ts-ignore
|
||||
let timeoutID
|
||||
return Promise.race([
|
||||
promise.then(v => {
|
||||
clearTimeout(timeoutID)
|
||||
return v
|
||||
}),
|
||||
|
||||
new Promise((_, rej) => {
|
||||
timeoutID = setTimeout(() => {
|
||||
rej(new Error(Constants.ErrorCode.TIMEOUT_ERR))
|
||||
}, 10000)
|
||||
})
|
||||
])
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {Promise<T>} promise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue