From 5cd889038e4820c49aee1fffe560382a5054329c Mon Sep 17 00:00:00 2001 From: Eric Mc Sween Date: Thu, 3 Sep 2020 15:52:09 -0400 Subject: [PATCH] Use _.once() instead of ad hoc implementation --- services/clsi/app/js/DockerRunner.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/services/clsi/app/js/DockerRunner.js b/services/clsi/app/js/DockerRunner.js index 33000d7ba6..e355f95067 100644 --- a/services/clsi/app/js/DockerRunner.js +++ b/services/clsi/app/js/DockerRunner.js @@ -137,12 +137,7 @@ const DockerRunner = { }, _runAndWaitForContainer(options, volumes, timeout, _callback) { - const callback = function (...args) { - _callback(...args) - // Only call the callback once - _callback = function () {} - } - + const callback = _.once(_callback) const { name } = options let streamEnded = false @@ -463,11 +458,7 @@ const DockerRunner = { }, waitForContainer(containerId, timeout, _callback) { - const callback = function (...args) { - _callback(...args) - // Only call the callback once - _callback = function () {} - } + const callback = _.once(_callback) const container = dockerode.getContainer(containerId)