-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add timeout for getPastEventsFrom #9
base: main
Are you sure you want to change the base?
Conversation
先就这样写了,这个东西同一个DelphinusContract 因为SetTimeout的handler是一个Process的全局变量,但是不改接口没法把handler id定义在Monitor的main里。 这块不知道有没有办法再不改接口的情况下能够一个process只存一套timeoutHandlerDict和timeOutId |
不对,我放在了class的static里,理论上就是全局的了。。。。不过不知道javascript的实现是不是符合。 |
src/client.ts
Outdated
}); | ||
|
||
// returns a race between timeout and the passed promise | ||
return Promise.race<T>([promise, timeoutPromise]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggested change:
return Promise.race([promise, timeoutPromise]).then({ (value) ==> clearTimeout(timeoutHandler)})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你说的很对,有方法可以弄好的。
已改完 |
|
||
// returns a race between timeout and the passed promise | ||
return Promise.race<T>([promise, timeoutPromise]) | ||
.then( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (Looks good to me)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
add a function to add timeout functionality for call web3 api.