Skip to content
This repository was archived by the owner on Aug 29, 2019. It is now read-only.
This repository was archived by the owner on Aug 29, 2019. It is now read-only.

Calling #subscribers on List consistently hitting API Rate Limit #36

@rmontgomery429

Description

@rmontgomery429

We are integrating with the Aweber API via the gem and we seem to be hitting the API Rate Limit a lot and we're only making calls like the following:

oauth = AWeber::OAuth.new(ENV['AWEBER_KEY'], ENV['AWEBER_SECRET'])
oauth.authorize_with_access('...', '...')

aweber = AWeber::Base.new(oauth)
list   = aweber.account.lists.find_by_name("some_list")

if list.subscribers.find_by_email('foo@bar.com').empty?
  list.subscribers.create({ ... })
end

We're getting a lot of very slow queries to Aweber from code like this. I can't see where the loop is but NewRelic is reporting that there are in some cases 30-40 calls made to /subscribers here.

36 more calls to Net::HTTP[https://api.aweber.com/1.0/accounts/.../lists/.../subscribers]: GET

Each call is also taking 1-2 seconds which is adding up to a very slow API call to get a list by a name and find a subscriber by an email. I hope those aren't looping over the subscribers when all were doing is calling find_by_email... right? That's not fetching all subscribers and then filtering in memory is it?

I would think find_by_name would be a search query to the server using something like the "find" method of the API. https://labs.aweber.com/docs/reference/1.0#subscriber_collection-find

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions