chrisleee / twitch-stocks

A web platform that allows you to invest in Twitch streamers with imaginary points.
GNU General Public License v3.0
21 stars 8 forks source link

Develop method(s) to continuously fetch data from Twitch API #38

Closed chrisleee closed 7 years ago

chrisleee commented 7 years ago

Proposed way of doing it is to loop endlessly: Start timer of 10-30 minutes (using an async timeout)

  1. Fetch streamer data (can do batches of 100 per second) If offline:
    1. Mutate viewers down to 0 or have an offline flag
  2. Store into database's increments viewer field
  3. Wait remaining time, if any, before executing next loop
chrisleee commented 7 years ago

An example of something similar I did for a previous side project is here: https://gist.github.com/ChrisALee/df421d291289797012a188a77755c383

Any gclient or vars stuff is related to storing/mutating the data in the GraphQL database. That'll be different for us. We plan on having this on a separate file that interacts directly with our MongoDB instance.