Use _.once() instead of ad hoc implementation
This commit is contained in:
@@ -137,12 +137,7 @@ const DockerRunner = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_runAndWaitForContainer(options, volumes, timeout, _callback) {
|
_runAndWaitForContainer(options, volumes, timeout, _callback) {
|
||||||
const callback = function (...args) {
|
const callback = _.once(_callback)
|
||||||
_callback(...args)
|
|
||||||
// Only call the callback once
|
|
||||||
_callback = function () {}
|
|
||||||
}
|
|
||||||
|
|
||||||
const { name } = options
|
const { name } = options
|
||||||
|
|
||||||
let streamEnded = false
|
let streamEnded = false
|
||||||
@@ -463,11 +458,7 @@ const DockerRunner = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
waitForContainer(containerId, timeout, _callback) {
|
waitForContainer(containerId, timeout, _callback) {
|
||||||
const callback = function (...args) {
|
const callback = _.once(_callback)
|
||||||
_callback(...args)
|
|
||||||
// Only call the callback once
|
|
||||||
_callback = function () {}
|
|
||||||
}
|
|
||||||
|
|
||||||
const container = dockerode.getContainer(containerId)
|
const container = dockerode.getContainer(containerId)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user