Repository: gatsbyjs/gatsby
File: packages/gatsby/src/utils/api-runner-node.js (JavaScript)

Code before:
                `createPages`
              )} and are awaiting any asynchronous method invocations (like ${chalk.bold(
                `graphql`
              )} or http requests).
              For more info and debugging tips: see ${chalk.bold(
                `https://gatsby.dev/sync-actions`
              )}
            `),
            ]

            const possiblyCodeFrame = getNonGatsbyCodeFrameFormatted()
            if (possiblyCodeFrame) {
              warning.push(possiblyCodeFrame)
            }

            reporter.warn(warning.join(`\n\n`))
            alreadyDisplayed = true
          }
        },
      }
    }
    const localReporter = getLocalReporter(activity, reporter)

    let runningActivities = new Set()

    const localReporterThatCleansUpAfterMisbahavingPlugins = {
      ...localReporter,
      activityTimer: (...args) => {
        const activity = reporter.activityTimer(...args)

        return {
          ...activity,
          start: () => {
            activity.start()
            runningActivities.add(activity)
          },
          end: () => {
            activity.end()
            runningActivities.delete(activity)
          },
        }
      },
      createProgress: (...args) => {
        const activity = reporter.createProgress(...args)

        return {
          ...activity,
          start: () => {
            activity.start()
            runningActivities.add(activity)
          },

Review comment (suggestion):
this is yikes - I don't like recreating this in wrapping `activity.start/end` like that, but don't really see fundamentally better way to do this

Code after:
                `createPages`
              )} and are awaiting any asynchronous method invocations (like ${chalk.bold(
                `graphql`
              )} or http requests).
              For more info and debugging tips: see ${chalk.bold(
                `https://gatsby.dev/sync-actions`
              )}
            `),
            ]

            const possiblyCodeFrame = getNonGatsbyCodeFrameFormatted()
            if (possiblyCodeFrame) {
              warning.push(possiblyCodeFrame)
            }

            reporter.warn(warning.join(`\n\n`))
            alreadyDisplayed = true
          }
        },
      }
    }
    const localReporter = getLocalReporter(activity, reporter)

    const runningActivities = new Set()

    const localReporterThatCleansUpAfterMisbehavingPlugins = {
      ...localReporter,
      activityTimer: (...args) => {
        const activity = reporter.activityTimer.apply(reporter, args)

        return {
          ...activity,
          start: () => {
            activity.start()
            runningActivities.add(activity)
          },
          end: () => {
            activity.end()
            runningActivities.delete(activity)
          },
        }
      },
      createProgress: (...args) => {
        const activity = reporter.createProgress.apply(reporter, args)

        return {
          ...activity,
          start: () => {
            activity.start()
            runningActivities.add(activity)
          },