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

Limit concurrency of remote file requests #50

Merged
merged 6 commits into from
Apr 22, 2019
Merged

Conversation

jonesbp
Copy link
Contributor

@jonesbp jonesbp commented Apr 16, 2019

Use bluebird’s Promise.map() with concurrency option to limit HTTP requests when creating remote nodes for file attachments in order to avoid being rate-limited by Airtable’s HTTP servers.

Use bluebird’s Promise.map() with concurrency option to limit HTTP requests when creating remote nodes for file attachments in order to avoid being rate-limited by Airtable’s HTTP servers.
gatsby-node.js Outdated Show resolved Hide resolved
gatsby-node.js Outdated Show resolved Hide resolved
@jbolda
Copy link
Owner

jbolda commented Apr 16, 2019

More recent versions of Gatsby removed the global polyfill for Bluebird so that is likely why your tests are failing. There probably isn't really a better / native way to handle this so it might be worth just adding Bluebird as a dependency and explicitly using the imported function here (not the global polyfill). (Unless you have a better idea.)

At minimum, I would ask that you add a comment in the code on "why this specific limit", but I'm wondering if maybe we make this configurable (with a reasonable default) since we are kind of shooting in the dark here it seems.

Copy link
Owner

@jbolda jbolda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great, and we have a green build. Would you mind adding some brief documentation? Then I think we are all set to merge.

jbolda
jbolda previously approved these changes Apr 20, 2019
@jbolda
Copy link
Owner

jbolda commented Apr 20, 2019

@jamessimone interested in reviewing since you looked before? Otherwise I'm happy with where this is at.

Thanks again for taking this on @jonesbp! 🎉

@jamessimone
Copy link
Collaborator

@jonesbp I do have some feedback about the wording in the readme. I'm also happy to push a commit for this if you'd like.

README.md Outdated Show resolved Hide resolved
Tighten language in documentation
@jonesbp
Copy link
Contributor Author

jonesbp commented Apr 22, 2019

I have applied the suggested documentation edits. Thanks @jamessimone .

@jbolda jbolda merged commit 43d77af into jbolda:master Apr 22, 2019
@jbolda
Copy link
Owner

jbolda commented Apr 22, 2019

Cheers! Thanks @jonesbp, published to v2.0.8.

@jamessimone
Copy link
Collaborator

@jonesbp nice job!

@rgesulfo
Copy link

Hi folks,
I'm still struggling with building my site from Airtable with a lot of attachements (images) per row.
If I understand correctly, I'm suppose to do concurrency: 0 in the gatsby-config.js. I'm just not sure where to put it.
@jonesbp, it seems that you were able to solve your problem. What is the solution for you?
Thanks for your help :)

@jbolda
Copy link
Owner

jbolda commented Feb 14, 2020

@rgesulfo oh, we didn't document it. It goes adjacent to the apiKey.

@rgesulfo
Copy link

Thanks @jbolda!
So something like this should work right?

...
{
      resolve: `gatsby-source-airtable`,
      options: {
        apiKey: `***`,
        concurrency: 0,
        tables: [
          {
            baseId: `***`,
            tableName: `***`,
            mapping: {
              photos: 'fileNode',
              summary: 'text/markdown',
            },
          },
        ],
      },
    },
...

Because it still fails for me.
Thanks again.

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

Successfully merging this pull request may close these issues.

4 participants