BoostIO / BoostNote-Legacy

This repository is outdated and new Boost Note app is available! We've launched a new Boost Note app which supports real-time collaborative writing. https://github.com/BoostIO/BoostNote-App
Other
17.07k stars 1.47k forks source link

very frequent API calls for PlantUML #2721

Open ghost opened 5 years ago

ghost commented 5 years ago

Current behavior

At the moment every time a change is detected, it waits for about 1 second (I assume) and then makes a request to the plantuml servers when working on a plantuml design. I worked on a rather small design and since it gets information really frequently from the API, the API blocked me rather quickly because of too many requests. After some time I got access again.

Expected behavior

Whenever I press some shortcut or press a button (preferably a shortcut) it requests the data from the API so it doesn't refuse the service because the request is issued too often.

Steps to reproduce

  1. Make a plantuml design
  2. make a ton of changes and requests to the api

Environment

arnaudroques commented 5 years ago

We are sorry about that, but as maintainer of PlantUML server, we do have to put protections against robot spamming and abusive use of our server.

We want to keep our service free and open. Having one request per second per IP is ok for us, so maybe the editor should buffer requests to our server to avoid flooding ?

daiyam commented 5 years ago

Adding a cache and a delay between each update should be fairly simple.

ghost commented 5 years ago

We are sorry about that, but as maintainer of PlantUML server, we do have to put protections against robot spamming and abusive use of our server.

We want to keep our service free and open. Having one request per second per IP is ok for us, so maybe the editor should buffer requests to our server to avoid flooding ?

I totally understand that you want to avoid spamming on your servers. That's why I suggested to set a shortcut which triggers the API request.

ghost commented 5 years ago

Adding a cache and a delay between each update should be fairly simple.

A cache is already in place I believe. \ Adding a delay to fix the problem isn't really ideal I'd say. I think it would be better to let the user decide when he wants to make the call to the API, since the problem with arbitrary calls isn't solved. I believe it's best if the user can decide for themselves when exactly the call should be issued so he can control it exactly. If the user then makes too many calls it's his problem and not boostnote's if that makes sense.

bllli commented 5 years ago

same issue

You can host yourself plantuml server, have no request rate limit. see: https://github.com/plantuml/plantuml-server

Flexo013 commented 5 years ago

If the limit is 1 call per IP per second (so 3600 calls per IP per hour) then this issue would be solved by simply showing "loading plantUML..." if there was a request in the last 1.1 seconds (includes some buffer). Once we know that the request won't get blocked we can send it and display the plantUML.

I don't imagine people will have a huge problem with having to wait a little over a second for a diagram to load. But in the event that people do hate the loading message and want an instant response then they can host their own plantUML server.

@LaniJW What do you think of such a solution?