Closed dinkan-z11 closed 3 years ago
Can you let me know what you mean by internal API ? If you are referring to the Protected Cowin APIs, you need to request for an API key from the Ministry of Health and Family Welfare to get it to work. Even if I received one I wouldn't be able to put that in the code as this is open source. I could setup a proxy server and route all requests from the users through that server in order to hide the API Key but that would just be an overkill. Some tools do that better than this script.
Yes, I do agree, the 15 min default interval does seem to be on the higher side. I have a PR that will change the minimum allowed interval from 5 minutes to 1 minutes (default is still 15 mins). But I strongly feel setting the interval to 10-15 seconds would cause unnecessary stress to the Cowin server as our tool is getting more than 1500+ weekly downloads on npm. If everyone starts to make API calls every few seconds we would overload the server. So because of that I don't intend the further reduce the interval below 1 minutes. But I do understand some people would still want a shorter interval, they can clone this repo , edit the code which handles the time interval and run the script locally. Although I still wouldn't recommend calling it every few seconds as the API's are cached and results can be upto 30mins old according the API Setu.
No offence, but in my opinion, lets not worry about the cowin's handling capacity as of now and give the user a chance to stay alive :)
Thanks, I didn't know the Protected API's didn't have authentication. Just tested it now and I'm getting a response from the API. If this API isn't cached this would be really helpful. I'll update the API urls.
None token, I completely agree with you, staying alive is more important right now than worrying about server loads. I thought I'll open an Issue asking about the interval and see how people respond to it.
As I mentioned in the previous comment, I have opened a new Issue - https://github.com/abhinavdc/cowin-pinger/issues/14 to ask everyone what they feel. Feel free to post your thoughts as well there.
I have updated the code to use the new API endpoints like you suggested and have reduced the time interval to 1 min as of now. Have updated the npm library as well with these new changes.
Hey I am new to JS, I have changed manually the time 60000 to time 10000 and executed but why does it ping only at 1min? @abhinavdc
If you have cloned the repo you should run node app.js run --age=30...
like this and shouldn't use npx cowin-pinger run ....
If you change 60000 to 10000 and pass --interval=1, the script should run every 10 seconds,
Suggestion: