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 :
|
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...).
When calling
findLyricsseveral times in a row, results may differ since it gives the lyrics found in the fastest responding website as per this code :alltomp3/index.js
Lines 192 to 201 in 7129f17
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:
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, thenreqParolesNet, etc...).