javatarz / github-contribution-leaderboard

Helps build a Hacktoberfest leaderboard on command line
Apache License 2.0
5 stars 10 forks source link

Make the web app reload a json file for users list after a set interval of time #36

Closed heaven00 closed 5 years ago

heaven00 commented 5 years ago

Value statement

As a(n) user
I want  the user list to be updated without restarting the app
So that I can on the fly update user list

Describe the solution you'd like A clear and concise description of what you want to happen.

Given a list of github user ids in a json file
When the app refreshes 
Then automatically update the user list with the new users ids.
heaven00 commented 5 years ago

Picking this up

sathia27 commented 5 years ago

I would like to pick up.

@javatarz @heaven00

Scenario1:
1. user ids will stored in json file.
2. When app refreshes, we will fetch user_ids from json instead of constant. This way, app restart not required.

Other suggestions:

instead of json, it could be redis, so user don't have to commit changes when user_ids are need to updated.
heaven00 commented 5 years ago

Redis might be overkill at the moment.

Let's stick to JSON also, can you think about adding a test for it?

sathia27 commented 5 years ago

@heaven00 made changes after review comment. please check and let me know.

javatarz commented 5 years ago

+1 on Redis being overkill. For an app as small as this, a simple dictionary that removes things after a timeout works fine.

Also, I'm curious about the users.json change. I'd like all the configuration to be in the same spot. I'm not a huge fan of building config files and distributing sample files to explain the structure to people. The advantage with CLI args is that when you make a mistake during startup, it's instant feedback.

We should probably move to accepting users through a REST endpoint eventually with a simple UI feature. I'd prefer that over a JSON config any day. I feel like the JSON config isn't a step in the direction of the REST endpoint.

I might be looking at this incorrectly. I'd love to hear your thoughts @sathia27 and @heaven00 :) Thanks once again for contributing to this project! Hope to keep improving this project together as a community ^_^

heaven00 commented 5 years ago

the idea is that users.json is not a config but a data file that contains user ids sort of a quick and dirty solution but we can do an API endpoint for it too, then probably we need to store the data at some place too @sathia27 @javatarz sqlite? or just a file? so that the app can restart with the current set.

javatarz commented 5 years ago

Playing devil's advocate here.. what about an in memory dictionary? sqlite is fine for me. Using a dict means you pass the users when you start the app. That's ok by me. If you do sqlite, that's fine too. :)

Point is, keep it lite, simple and easy ;)

javatarz commented 5 years ago

Just had a word with @heaven00 offline. I'm going to close this ticket and he's going to raise one to add an end-point for the post request to add more users to an in-memory dictionary or sqlite.