-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
When calling findLyrics several times in a row, results may differ since it gives the lyrics found in the fastest responding website as per this code :
Lines 192 to 201 in 7129f17
| promises.push(reqWikia); | |
| promises.push(reqParolesNet); | |
| promises.push(reqLyricsMania1); | |
| promises.push(reqLyricsMania2); | |
| promises.push(reqLyricsMania3); | |
| promises.push(reqSweetLyrics); | |
| return Promise.any(promises).then((lyrics) => { | |
| return lyrics; | |
| }); |
This might be the best for speed, but not for consistency as one will get different lyrics on different calls.
The code above could be replaced with something like:
return reqWikia
.catch(() => reqParolesNet)
.catch(() => reqLyricsMania1)
.catch(() => reqLyricsMania2)
.catch(() => reqLyricsMania3)
.catch(() => reqSweetLyrics)Requests would still be made in parallel but that would give a preference order to the websites that are requested (in this example first reqWikia, then reqParolesNet, etc...).
Metadata
Metadata
Assignees
Labels
No labels