Skip to content

Commit

Permalink
chore: Add reporter, timer, to API fetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
kevee committed Nov 5, 2020
1 parent 86f16f7 commit 7d9a514
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugins/gatsby-source-covid-tracking-api/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports.sourceNodes = async (
) => {
const { createNode } = actions
const { file, sortField, type, increaseFields } = configOptions

const start = new Date()
try {
fs.statSync(file)
} catch {
Expand Down Expand Up @@ -65,5 +65,10 @@ Make sure to run "npm run setup" to clone the most recent version of the COVID A

createNode({ ...item, ...nodeTemplate })
})
reporter.success(`Created ${items.length} ${type} nodes`)
const end = new Date()
reporter.success(
`Created ${items.length} ${type} nodes in ${(end.getTime() -
start.getTime()) /
1000}s`,
)
}

0 comments on commit 7d9a514

Please sign in to comment.