Skip to content
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 timed delays for attribute resolution #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

moda20
Copy link
Contributor

@moda20 moda20 commented Apr 27, 2022

this will fix the thousand request for resolve/result that freezes webpages

new Date(new Date().getTime() + 1000);
response = request('GET', `${this.nodeBaseUrl}/resolve/result/${handler}`);
body = JSON.parse(response.getBody());
if((new Date().getTime()) > milestonesDate + 1000){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use a sleep (setTimeout) here ? Otherwise the while loop will keep running and it might be cpu intensive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, there is an issue with this Proxy class not having any async or await or promises in it. introducing the sleep using setTimeout will need the use of promises and will affect the usage of the sdk. I think this is the reason why we are using the sync-request library to make requests in the first place.

So my solution here seemed the best solution to delay requests, but i agree there is an infinite loop there.
we need to ask @kotlarmilos form more info about the proxy and whether we rewrite it to use promises instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants