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

An error occurred while processing the query (4 [Exception]: Quota limit exceeded) #32

Closed
ShadowFM opened this issue Jan 29, 2021 · 8 comments

Comments

@ShadowFM
Copy link

Hey, first of all the tool you've created is very cool and thanks for creating such a tool!

I've tried to download nearly anything from Avicii with the following command:
freyr get https://www.deezer.com/us/artist/293585 -l artist="Avicii"

My problem is that I received after some Collating... infos this error:

[i] An error occurred while processing the query (4 [Exception]: Quota limit exceeded)
========== Stats ==========
 [•] Runtime: [4.7s]
 [•] Total queries: [01]
 [•] Total tracks: [00]
     » Skipped: [00]
     ✓ Passed:  [00]
     ✕ Failed:  [00]
 [•] Output directory: [.]
 [•] Cover Art: cover.png (640x640)
 [•] Total Output size: 0.00 B
 [•] Total Network Usage: 0.00 B
     ♫ Media: 0.00 B
     ➤ Album Art: 0.00 B
 [•] Output bitrate: 320k

What could I do to get any album/song from an artist?

@miraclx
Copy link
Owner

miraclx commented Jan 29, 2021

Hi, Thanks for your kind remarks

Please include the full output of this execution with the SHOW_DEBUG_STACK = 1 ENV set

@ShadowFM
Copy link
Author

I see only these messages

(45) [Superlove (Radio Edit)] (single)
   [•] Inquiring tracks...[done]
    • [01 Superlove (Avicii vs. Lenny Kravitz) (Radio Edit)]
       | ➤ Collating sources...
       |  ➤ [•] YouTube Music...(failed: [Error: YouTube Music is not available in your country
    at YouTubeMusic.request (/usr/lib/node_modules/freyr/src/services/youtube.js:84:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async YouTubeMusic.getApiKey (/usr/lib/node_modules/freyr/src/services/youtube.js:90:18)
    at async YouTubeMusic.search (/usr/lib/node_modules/freyr/src/services/youtube.js:118:40)
    at async YouTubeMusic.search (/usr/lib/node_modules/freyr/src/services/youtube.js:285:21)])
       |  ➤ [•] YouTube...[success, found 33 sources]
       | ➤ Awaiting audiofeeds...[done]
       | [✓] Got album art
       | [✓] Got raw track file
       | [•] Post Processing...
  (46) [Superlove] (single)
   [•] Inquiring tracks...[done]
    • [01 Superlove]
       | ➤ Collating sources...
       |  ➤ [•] YouTube Music...(failed: [Error: YouTube Music is not available in your country
    at YouTubeMusic.request (/usr/lib/node_modules/freyr/src/services/youtube.js:84:13)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async YouTubeMusic.getApiKey (/usr/lib/node_modules/freyr/src/services/youtube.js:90:18)
    at async YouTubeMusic.search (/usr/lib/node_modules/freyr/src/services/youtube.js:118:40)
    at async YouTubeMusic.search (/usr/lib/node_modules/freyr/src/services/youtube.js:285:21)])
       |  ➤ [•] YouTube...[success, found 22 sources]
       | ➤ Awaiting audiofeeds...[done]
       | [✓] Got album art
       | [✓] Got raw track file
       | [•] Post Processing...
  (47) [Silhouettes] (single)
   [•] Inquiring tracks...[done]
    • [01 Silhouettes (Original Radio Edit)]
       | [»] Track exists. Skipping...
    • [02 Silhouettes (Original Mix)]
       | [»] Track exists. Skipping...
  (48) [Dancing In My Head (Tom Hangs Remix)] (single)
   [•] Inquiring tracks...[done]
    • [01 Dancing In My Head]
       | [•] Didn't match filter. Skipping...
 [i] An error occurred while processing the query (4 [Exception]: Quota limit exceeded)
========== Stats ==========

@miraclx
Copy link
Owner

miraclx commented Jan 29, 2021

Hi @ShadowFM, I didn't know Deezer had a Quota limit

I'll check if there's a workaround for this, maybe they now have API keys.

In the meantime, you can use either of these services;

@miraclx
Copy link
Owner

miraclx commented Jan 29, 2021

Just saw this https://developers.deezer.com/api
Screenshot_20210130_024541
I don't like it, but I can now engineer a slowdown on the request queue before forwarding it to Deezer to ensure it keeps to this limit.

@miraclx
Copy link
Owner

miraclx commented Jan 30, 2021

Fixed in 46e696a

@miraclx
Copy link
Owner

miraclx commented Jan 30, 2021

This ensures freyr cannot itself send over 50 requests in 5 seconds.
However, because Deezer doesn't use API keys, I suspect, in-place of that enforces that limit on an IP-basis.

For every 5 seconds that freyr send N queries through freyr's DeezerCore, it only sends at most 50 queries and keeps the remaining N-50 queries (if any) waiting for that 5-second limit to be over, and then it waits for the preceding 50 queries to be fully completed to account for any undocumented server behavior.

So, sometimes, you might get this error if you'd already been querying the API outside of freyr, because freyr cannot account for external use of the server. And there isn't a way to query the server for a retry after duration.

@miraclx
Copy link
Owner

miraclx commented Jan 30, 2021

Tested. This limitation is indeed IP-based and this quota applies to all devices under the same public IP.

A ninja workaround would be exponential backoff or some variation of that.

So when a Quota limit is hit, it just reschedules itself for a retry after some time.

@miraclx
Copy link
Owner

miraclx commented Feb 4, 2021

Implemented retries on da0cf5b...9e8c827

See the Deezer section of Service Configuration for documentation on this.

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