Skip to content

Commit

Permalink
Memory Leak Patch File (#908)
Browse files Browse the repository at this point in the history
Add a patch file for fixing the memory leak

The grunt file hasn't changed in a while so this should work back to v1.17

J=SLAP-1484
TEST=manual

Build a site on SGS and apply the patch file. Observe a consistent build time upon file changes
  • Loading branch information
cea2aj committed Aug 6, 2021
1 parent 9892543 commit c91504c
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions patches/memory-leak.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
From 88e185914a5d8d0739277d62e60e47b69f93a6d8 Mon Sep 17 00:00:00 2001
From: Connor Anderson <canderson@yext.com>
Date: Thu, 5 Aug 2021 13:19:38 -0400
Subject: [PATCH] Gruntfile Memory Leak Fix for v1.17 through v1.22.2

---
Gruntfile.js | 32 +++++++-------------------------
1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index b8b8e95..0bd44d4 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,5 +1,5 @@
const webpackConfig = require('./webpack-config');
-const { exec } = require("child_process");
+const { spawnSync } = require('child_process');
const jamboConfig = require('./jambo.json');

const outputDir = jamboConfig.dirs.output;
@@ -12,34 +12,16 @@ module.exports = function (grunt) {
watch: {
all: {
files: ['**', '!**/node_modules/**', `!${outputDir}/**`],
- tasks: ['jambobuild', 'webpack',],
- options: {
- spawn: false,
- },
+ tasks: ['build-site']
},
},
});
-
grunt.loadNpmTasks('grunt-webpack');
grunt.loadNpmTasks('grunt-contrib-watch');
-
- grunt.registerTask('jambobuild', 'Jambo build.',
- function() {
- // Force task into async mode and grab a handle to the "done" function.
- var done = this.async();
- // Run some sync stuff.
- grunt.log.writeln('Processing task...');
- // And some async stuff.
- exec('npx jambo build', (error, stdout, stderr) => {
- if (error) {
- console.log(error.message);
- done(false);
- return;
- }
-
- stderr && console.error(stderr);
- stdout && console.log(stdout);
- done();
+ grunt.registerTask('build-site', 'Builds the site.', () => {
+ spawnSync('npx jambo build && npx webpack --config webpack-config.js', {
+ shell: true,
+ stdio: 'inherit'
});
});
-}
+}
\ No newline at end of file
--
2.32.0

0 comments on commit c91504c

Please sign in to comment.