The Wayback Machine - https://web.archive.org/web/20220402213043/https://github.com/lichess-org/lila/issues/10266
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

switch from throttle to throttlePromise for asynchronous calls #10266

Open
niklasf opened this issue Dec 24, 2021 · 10 comments
Open

switch from throttle to throttlePromise for asynchronous calls #10266

niklasf opened this issue Dec 24, 2021 · 10 comments
Labels
good first issue no scala

Comments

@niklasf
Copy link
Member

@niklasf niklasf commented Dec 24, 2021

In ui/, identify uses of throttle(delay, wrapped) that wrap networks calls. Replace these with throttlePromise(finallyDelay(delay, wrapped)).

This will ensure that only one request of each kind is made in parallel, and the delay is added to the server response time.

@niklasf niklasf added good first issue no scala labels Dec 24, 2021
@EnriqueBet
Copy link

@EnriqueBet EnriqueBet commented Dec 26, 2021

can I get assigned to this issue please?

@yafred
Copy link
Contributor

@yafred yafred commented Jan 2, 2022

Here is the list of what I think are network calls. Can you confirm please ?

  • this.socket.sendAnaDests
  • lichess.pubsub.emit
  • xhr
  • this.socketSend
  • send('moretime')
  • post
  • json(/swiss..)
@benediktwerner
Copy link
Collaborator

@benediktwerner benediktwerner commented Jan 6, 2022

pubsub.emit isn't a network call. Rest seems correct. Easier to say if you create a PR though so we can see the context.

@EnriqueBet
Copy link

@EnriqueBet EnriqueBet commented Jan 6, 2022

I'll submit a PR soon, thank you for the suggestions

@niklasf
Copy link
Member Author

@niklasf niklasf commented Jan 8, 2022

The type checker will show this anyway, but to clarify: This only makes sense for network calls that return a Promise with the result, so basically anything using fetch() internally. socket.send() goes over the network, but it doesn't wait for a response, so the old synchronous throttling is fine and throttlePromise() makes no sense.

@Hoskayne
Copy link

@Hoskayne Hoskayne commented Mar 13, 2022

Is this issue resolved? I am open to taking over/helping with this issue.

@EnriqueBet
Copy link

@EnriqueBet EnriqueBet commented Mar 13, 2022

@Hoskayne will you be up to pair programming with this issue? I tried to start long time ago but my experience is very limited with TS/JS

Virinas-code added a commit to Virinas-code/lila that referenced this issue Mar 23, 2022
@Virinas-code
Copy link
Contributor

@Virinas-code Virinas-code commented Mar 23, 2022

I'm trying to work on this. I'll submit a PR soon.

Virinas-code added a commit to Virinas-code/lila that referenced this issue Mar 23, 2022
Virinas-code added a commit to Virinas-code/lila that referenced this issue Mar 23, 2022
Virinas-code added a commit to Virinas-code/lila that referenced this issue Mar 23, 2022
@Virinas-code
Copy link
Contributor

@Virinas-code Virinas-code commented Mar 23, 2022

Seems like there is some problems... I'm updating 👍

@Virinas-code
Copy link
Contributor

@Virinas-code Virinas-code commented Mar 23, 2022

This is really hard... It takes a long time to understand the code. I'm going to make a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue no scala
6 participants