Closed bmaupin closed 4 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.
Seems like this might still be happening even after the fix, although to a lesser scale.
To investigate:
Just confirmed; running a query for a new month only returned a small subset of the scores for the latest date:
[
{
"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
}
}
]
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.