Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bmaupin opened this issue Jun 1, 2019 · 3 comments
Closed

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

bmaupin opened this issue Jun 1, 2019 · 3 comments
Assignees

Comments

@bmaupin
Copy link
Owner

bmaupin commented Jun 1, 2019

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 bmaupin self-assigned this Jun 1, 2019
@bmaupin
Copy link
Owner Author

bmaupin commented Jun 14, 2019

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
Copy link
Owner Author

bmaupin commented Dec 18, 2019

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

To investigate:

  • Could we replace the current caching with Cache-Control?
  • If not, we'll have to dig deeeper into why this is happening and fix it

@bmaupin bmaupin reopened this Dec 18, 2019
@bmaupin
Copy link
Owner Author

bmaupin commented Feb 1, 2020

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
    }
  }
]

bmaupin added a commit to bmaupin/langtrends-api that referenced this issue Feb 6, 2020
@bmaupin bmaupin closed this as completed in e2e3ce5 Feb 7, 2020
bmaupin added a commit to bmaupin/langtrends-data that referenced this issue Oct 5, 2021
bmaupin added a commit to bmaupin/langtrends-api that referenced this issue Mar 14, 2023
bmaupin added a commit that referenced this issue Mar 15, 2023
bmaupin added a commit that referenced this issue Mar 15, 2023
We can do this now that the API data for each date is populated using a transaction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant