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

Duplicated requests to API #61

Open
skuark opened this issue May 7, 2021 · 2 comments
Open

Duplicated requests to API #61

skuark opened this issue May 7, 2021 · 2 comments

Comments

@skuark
Copy link
Member

skuark commented May 7, 2021

Orientation

While debugging something else, we've found in our internal BeBanjo's logging system a series of duplicated API requests: one authorized, and another one unauthorized. After digging a bit on this, we've found this problem comes from the Almodovar gem.

How to reproduce

By simply running this snippet locally…

require "almodovar"
auth = Almodovar::DigestAuth.new("realm", "user", "password")
movida = Almodovar::Resource("https://staging-movida.bebanjo.net/api", auth)
movida.titles(external_id: "wadus").first

…we can find duplicated requests in our logs for each call to the API:

Captura de pantalla 2021-05-07 a las 17 13 11

This happens with other actions, non-only with GET requests.

@skuark skuark added the bug label May 7, 2021
@skuark skuark changed the title Duplicated calls to API Duplicated requests to API May 7, 2021
@littlemove
Copy link
Contributor

@skuark I'm not able to reproduce this, meaning seen an authorized request followed by an authorized one.

Seen duplicated API calls when using Almodovar in console is expected. If you instantiate an Almodovar::Resource in a console, it's normal to see duplicate API calls because of how Almodovar is built: it delegates the inspect method to the HTTP call so everytime IRB outputs a value it will call inspect hence doing another request.

Do you have any other input (i.e. what user were you using, which Almodovar version, ...) ?

@skuark
Copy link
Member Author

skuark commented May 17, 2021

@littlemove Hi Diego. I've tried and reproduced it again, but it's weird… I can't reproduce it consistently (on every run of the snippet).

But I've reproduced it with two combinations:

  • Ruby 2.3.3 and almodovar 1.7.3
  • Ruby 2.7.2 and almodovar 1.7.7

I will ping you later over Slack to discuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants