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

Rate limiting during OneNote import #15

Closed
altano opened this issue Mar 27, 2022 · 5 comments
Closed

Rate limiting during OneNote import #15

altano opened this issue Mar 27, 2022 · 5 comments

Comments

@altano
Copy link

altano commented Mar 27, 2022

Describe the bug
During an import of my OneNote notebooks the network requests started to fail with HTTP error code 429 (rate limiting).

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://importer.notesnook.com/
  2. Select OneNote importer
  3. Login and consent
  4. import begins
  5. I checked network dev tools and it looks like all requests to graph.microsoft.com started returning 429 http errors:
{
	"error": {
		"code": "20166",
		"message": "The app has issued too many requests on behalf of this user in a short time period.",
		"innerError": {
			"date": "2022-03-27T21:54:33",
			"request-id": "<redacted>",
			"client-request-id": "<redacted>"
		}
	}
}

NOTE: Import is actually still ongoing and at the "Transforming pages" phase, but will definitely not complete successfully given all the network errors.

Expected behavior
Import completes successfully

Desktop (please complete the following information):

  • Firefox v98.0.2
  • Notesnook Importer v1.2.1

Additional context

  • I analyzed the network requests and it looks like I got a 429 http error response to requests # 292, 310, 646, and then EVERY request starting at # 938. I think I'm hitting the documented OneNote service limits. I would guess that at first I'm occasionally hitting the per-minute limit but at some point I hit the per-hour rate limit of 800.
  • The Retry-After http response header mentioned in the documentation is NOT present in my http responses.

Ideas to fix it... I'm just brainstorming

  • Can more requests be batched up to reduce the amount sent?
  • Handle a 429 error response by backing off before either retrying or sending the next request. The Importer just keeps making requests after a 429 error right now. This can use exponential backoff. Unfortunately it might need to wait >1hr given the OneNote limits, but I'd be okay with that?
  • Allow me to import one notebook at a time. That way I could manually eventually import all my notebooks as long as no single notebook was over the rate limit.
@altano
Copy link
Author

altano commented Mar 27, 2022

FWIW the import eventually failed with a ton of errors, as expected:
image

@thecodrr
Copy link
Contributor

@altano what's the state of the notes that did get converted? I didn't think about service limits so I might have to get Notebooks + section groups + sections in a single request — this might help make it a bit better. But some kind of throttling is still required in case of getting pages.

@altano
Copy link
Author

altano commented Mar 28, 2022

UPDATE: Oops, I didn't originally test all these with the new import zip file (I got tripped up by the fact that deleting all my notebooks doesn't delete all my notes). Sorry for the noise. I went ahead and updated everything below to reflect the new import.

It's looking improved over the last time I tried this a while ago. I think this is almost usable for me!

These are fixed:

I'm still seeing these but that might be caused by the 429 errors:

These I can't test:

@thecodrr thecodrr transferred this issue from streetwriters/notesnook Oct 4, 2022
@thecodrr thecodrr closed this as completed Dec 1, 2023
@altano
Copy link
Author

altano commented Dec 1, 2023

Oh nice, were you able to fix this @thecodrr ?

I actually have an open PR with the graph sdk because they should be handling this better on their end: microsoftgraph/msgraph-sdk-javascript#1514

@thecodrr
Copy link
Contributor

thecodrr commented Dec 1, 2023

@altano yes! give it a try in v2.1.2 of the Importer. It should work much better.

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

No branches or pull requests

2 participants