From ad116c385ab21af1bb8af70e22c6382fd3618c97 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Sat, 1 May 2021 20:15:27 +0530 Subject: [PATCH] fix: Exit redis after setting value so that process can exit --- esbuild/esbuild.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/esbuild/esbuild.js b/esbuild/esbuild.js index 62c3712f7a..6edcaa4fb5 100644 --- a/esbuild/esbuild.js +++ b/esbuild/esbuild.js @@ -59,7 +59,7 @@ const NODE_PATHS = [].concat( .filter(fs.existsSync) ); -execute(); +execute().catch(e => console.error(e)); async function execute() { console.time(TOTAL_BUILD_TIME); @@ -81,7 +81,7 @@ async function execute() { } else { log("Watching for changes..."); } - await write_meta_file(result.metafile); + return await write_meta_file(result.metafile); } function build_assets_for_apps(apps) { @@ -287,7 +287,12 @@ function write_meta_file(metafile) { .then(() => { let client = get_redis_subscriber("redis_cache"); // update assets_json cache in redis, so that it can be read directly by python - return client.set("assets_json", assets_json); + client.set("assets_json", assets_json, (err) => { + if (err) { + log_warn("Could not update assets_json in redis_cache"); + } + client.unref(); + }); }); } @@ -296,7 +301,6 @@ async function notify_redis({ error, success }) { // notify redis which in turns tells socketio to publish this to browser let payload = null; - if (error) { let formatted = await esbuild.formatMessages(error.errors, { kind: "error", @@ -338,4 +342,6 @@ function open_in_editor() { subscriber.subscribe("open_in_editor"); } -open_in_editor(); +if (WATCH_MODE) { + open_in_editor(); +}