diff --git a/packages/gatsby-source-drupal/README.md b/packages/gatsby-source-drupal/README.md index 16eee5609108e..732653c6932fc 100644 --- a/packages/gatsby-source-drupal/README.md +++ b/packages/gatsby-source-drupal/README.md @@ -2,7 +2,7 @@ Source plugin for pulling data (including images) into Gatsby from Drupal sites. -Pulls data from Drupal 8 sites with the +It pulls data from Drupal 8 sites with the [Drupal JSONAPI module](https://www.drupal.org/project/jsonapi) installed. An example site built with the headless Drupal distro diff --git a/packages/gatsby-source-drupal/src/gatsby-node.js b/packages/gatsby-source-drupal/src/gatsby-node.js index 14b961e1e9a16..ed65d5419dfa9 100644 --- a/packages/gatsby-source-drupal/src/gatsby-node.js +++ b/packages/gatsby-source-drupal/src/gatsby-node.js @@ -64,6 +64,10 @@ async function worker([url, options]) { const response = await got(url, { agent, cache: false, + timeout: { + // Occasionally requests to Drupal stall. Set a 15s timeout to retry in this case. + request: 15000, + }, // request: http2wrapper.auto, // http2: true, ...options, @@ -259,7 +263,7 @@ ${JSON.stringify(webhookBody, null, 4)}` // lastFetched isn't set so do a full rebuild. if (!lastFetched) { - setPluginStatus({ lastFetched: new Date().getTime() }) + setPluginStatus({ lastFetched: Math.floor(new Date().getTime() / 1000) }) requireFullRebuild = true } else { const drupalFetchIncrementalActivity = reporter.activityTimer( @@ -272,7 +276,11 @@ ${JSON.stringify(webhookBody, null, 4)}` try { // Hit fastbuilds endpoint with the lastFetched date. const res = await requestQueue.push([ - urlJoin(baseUrl, `gatsby-fastbuilds/sync/`, lastFetched.toString()), + urlJoin( + baseUrl, + `gatsby-fastbuilds/sync/`, + Math.floor(lastFetched).toString() + ), { username: basicAuth.username, password: basicAuth.password, diff --git a/packages/gatsby-source-drupal/src/utils.js b/packages/gatsby-source-drupal/src/utils.js index 858d861db447e..ebd51f4a71478 100644 --- a/packages/gatsby-source-drupal/src/utils.js +++ b/packages/gatsby-source-drupal/src/utils.js @@ -364,7 +364,7 @@ ${JSON.stringify(nodeToUpdate, null, 4)} node.internal.contentDigest = createContentDigest(node) createNode(node) reporter.log( - `Updated Gatsby node: id: ${node.id} — type: ${node.internal.type}` + `Updated Gatsby node — id: ${node.id} type: ${node.internal.type}` ) } }