Coder Social home page Coder Social logo

agile-story-index's People

Contributors

rogarithm avatar

Watchers

 avatar

agile-story-index's Issues

api rate limit 처리 어떻게 해야할까?

문제 상황

  • 관련 문서에 따르면 1분에 15개의 요청만 가능하다.
  • 하지만 URL 15개씩 조각을 나눠 1분마다 API 요청하도록 구현했을 때, 일부는 성공하고 일부는 실패하는 케이스가 자주 있다.
  • 더 낙관적으로 2분마다 15개씩 요청하도록 했을 때도 결과는 별반 다르지 않았다.

예상한 원인

api rate limit은

  1. 각 요청을 보낸 시점을 기준으로 하므로, 로컬에서 (가장 마지막 요청인) 15번째 요청을 보낸 시점부터 1분간 쉬면 다음 15개의 요청을 보낼 수 있다.
  2. api를 제공하는 외부 서버가 요청을 받은 시점을 기준으로 하므로, 로컬에서 보낸 15개의 요청이 서버에 모두 도달한 시점부터 1분간 쉬면 다음 15개의 요청을 보낼 수 있다.
  3. api 요청에 대한 응답을 로컬에서 돌려받은 시점을 기준으로 하므로, 로컬에서 보낸 15개의 요청에 대한 응답이 로컬에 도달한 시점부터 1분간 쉬면 다음 15개의 요청을 보낼 수 있다.

구현 방안

  1. api rate limit 처리 방법을 고친다
    • 예상한 원인의 2나 3을 코드에 반영할 수 있다면 그렇게 수정한다
    • 15개의 요청을 보내고 난 후 x minute 쉬도록 구현되어 있는 것을 15개 요청의 각 요청을 보내고 난 후 x/15 minute 쉬도록 바꾼다
  2. 현재 구현에서 불필요한 추가 요청을 줄인다
    • 일부가 실패한 조각의 경우, 다시 요청한다고 할 때 이전에 성공한 URL까지 다시 요청할 필요는 없어 보인다.
    • 하나의 조각을 구성하는 각 URL마다 그 URL로 한 요청이 성공했는지 판별할 수 있어야 한다
    • 다시 요청했을 떄 성공한 결과를 적절한 위치에 배치할 수 있어야 한다
    • 인덱스 파일을 만들 데이터 형식을 수정하는 게 수월해 보인다
    • 연/월 값을 기준으로 하는 방법과, 각 조각의 인덱스 값을 기준으로 하는 방법이 있을 것 같다

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.