Skip to content

Commit

Permalink
Merge pull request #25 from raubin/master
Browse files Browse the repository at this point in the history
Add configuration option for number of objects fetched per request
  • Loading branch information
jazibsawar committed Jan 26, 2021
2 parents cdf05a0 + 61a19fb commit 3b2958f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ plugins: [
apiAccess: {
read_key: ``, // Get this value in Bucket > Settings
},
localMedia: true // Download media locally for gatsby image (optional)
localMedia: true, // Download media locally for gatsby image (optional)
limit: 1000, // The number of Objects to fetch on each request (optional)
}
},
]
Expand Down
2 changes: 1 addition & 1 deletion src/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ module.exports = async ({
bucketSlug,
objectType,
apiAccess,
limit,
preview,
}) => {
const timeLabel = `Fetch Cosmic JS data for (${objectType})`
const axiosHeader = {
headers: { 'Accept-Encoding': 'gzip, deflate' },
}
let objects = []
const limit = 1000
let skip = 0
console.time(timeLabel)
console.log(`Starting to fetch data from Cosmic JS (${objectType})`)
Expand Down
2 changes: 2 additions & 0 deletions src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ exports.sourceNodes = async (
bucketSlug = '',
objectTypes = [],
apiAccess = {},
limit = 1000,
preview = false,
localMedia = false,
}
Expand Down Expand Up @@ -57,6 +58,7 @@ exports.sourceNodes = async (
bucketSlug,
objectType,
apiAccess,
limit,
preview,
})
)
Expand Down

0 comments on commit 3b2958f

Please sign in to comment.