These changes will fix the issue with ./api consuming more Github API quota then it needs, due to two reasons:
this project got renamed, and Github now returns 301 which consume API Rate Limit.
Calls to Github API happen concurrently, which may lead to potential corruption of cache data (eg: two calls happen at the same time, and both try to update the cache)
you give it another function as an argument, and It returns a locked version of that function.
the locked function ensures that it only runs once at a time.
If you call the locked function multiple times while it's still in use (eg: in a Promise.all), these new calls will be added to a queue, and will get executed once their turns come.
If you call the locked function multiple times with the same arguments while it's still in use, here it will not add the new calls to the queue, instead, it will attach them to the existent queue Item, and then when this Item's turn is reached, it will resolve and call back all the attached function calls, both the old ones and the newly added calls.
Made the FetchService more versatile, allowing to pass headers.
Added optional GITHUB_TOKEN params, which will be used to increase the Rate Limit from 60 to 5000.
Fixed the redirection response we get because of the renaming of the Moadaly project.
Added a Github controller with /Github/RateLimit endpoint
Added a script to generate nodemon.json to watch all @dzcode.io/* dependencies, and used it in ./api and ./data
Type of change
Bug fix (non-breaking change which fixes an issue)
Description
These changes will fix the issue with
./api
consuming more Github API quota then it needs, due to two reasons:The changes include:
lock
function:Promise.all
), these new calls will be added to a queue, and will get executed once their turns come.FetchService
more versatile, allowing to pass headers.GITHUB_TOKEN
params, which will be used to increase the Rate Limit from 60 to 5000.Moadaly
project./Github/RateLimit
endpoint@dzcode.io/*
dependencies, and used it in./api
and./data
Type of change