bmaupin / langtrends

Programming language trends
https://bmaupin.github.io/langtrends/
MIT License
3 stars 1 forks source link

Incorrect data could be cached at the beginning of the month #1

Closed bmaupin closed 4 years ago

bmaupin commented 5 years ago

With the current logic, the current year/month is compared with the latest from the API. Unfortunately, the API will return the current year/month even if it hasn't finished loading all the current data.

One solution could be comparing not just the year/month but also the number of languages.

bmaupin commented 5 years ago

A smarter way to do this might be to add a custom endpoint to the API so it could tell us when it's done syncing. But this works for now.

bmaupin commented 4 years ago

Seems like this might still be happening even after the fix, although to a lesser scale.

To investigate:

bmaupin commented 4 years ago

Just confirmed; running a query for a new month only returned a small subset of the scores for the latest date:

https://langtrends.herokuapp.com/api/scores?filter=%7B%22where%22:%7B%22or%22:%5B%7B%22date%22:%222019-02-01T00:00:00.000Z%22%7D,%7B%22date%22:%222019-03-01T00:00:00.000Z%22%7D,%7B%22date%22:%222019-04-01T00:00:00.000Z%22%7D,%7B%22date%22:%222019-05-01T00:00:00.000Z%22%7D,%7B%22date%22:%222019-06-01T00:00:00.000Z%22%7D,%7B%22date%22:%222019-07-01T00:00:00.000Z%22%7D,%7B%22date%22:%222019-08-01T00:00:00.000Z%22%7D,%7B%22date%22:%222019-09-01T00:00:00.000Z%22%7D,%7B%22date%22:%222019-10-01T00:00:00.000Z%22%7D,%7B%22date%22:%222019-11-01T00:00:00.000Z%22%7D,%7B%22date%22:%222019-12-01T00:00:00.000Z%22%7D,%7B%22date%22:%222020-01-01T00:00:00.000Z%22%7D,%7B%22date%22:%222020-02-01T00:00:00.000Z%22%7D%5D%7D,%22include%22:%22language%22%7D

[
  {
    "date": "2020-02-01T00:00:00.000Z",
    "points": 33435,
    "id": 28309,
    "languageId": 1,
    "language": {
      "name": "ActionScript",
      "stackoverflowTag": null,
      "id": 1
    }
  },
  {
    "date": "2020-02-01T00:00:00.000Z",
    "points": 1654035,
    "id": 28310,
    "languageId": 2,
    "language": {
      "name": "C",
      "stackoverflowTag": null,
      "id": 2
    }
  },
  {
    "date": "2020-02-01T00:00:00.000Z",
    "points": 3395138,
    "id": 28311,
    "languageId": 3,
    "language": {
      "name": "C#",
      "stackoverflowTag": null,
      "id": 3
    }
  },
  {
    "date": "2020-02-01T00:00:00.000Z",
    "points": 2561530,
    "id": 28312,
    "languageId": 4,
    "language": {
      "name": "C++",
      "stackoverflowTag": null,
      "id": 4
    }
  },
  {
    "date": "2020-02-01T00:00:00.000Z",
    "points": 84064,
    "id": 28313,
    "languageId": 5,
    "language": {
      "name": "Clojure",
      "stackoverflowTag": null,
      "id": 5
    }
  },
  {
    "date": "2020-02-01T00:00:00.000Z",
    "points": 75448,
    "id": 28314,
    "languageId": 6,
    "language": {
      "name": "CoffeeScript",
      "stackoverflowTag": null,
      "id": 6
    }
  },
  {
    "date": "2020-02-01T00:00:00.000Z",
    "points": 597789,
    "id": 28315,
    "languageId": 7,
    "language": {
      "name": "Go",
      "stackoverflowTag": null,
      "id": 7
    }
  },
  {
    "date": "2020-02-01T00:00:00.000Z",
    "points": 140237,
    "id": 28316,
    "languageId": 8,
    "language": {
      "name": "Haskell",
      "stackoverflowTag": null,
      "id": 8
    }
  }
]