MCPcopy Create free account
hub / github.com/dadi/api / wrapForegroundJob

Method wrapForegroundJob

dadi/lib/workQueue.js:64–82  ·  view source on GitHub ↗
(wrappedFunction)

Source from the content-addressed store, hash-verified

62 }
63
64 wrapForegroundJob(wrappedFunction) {
65 const context = this
66
67 return function() {
68 const jobId = context.startForegroundJob()
69
70 return Promise.resolve(wrappedFunction.apply(this, arguments))
71 .then(result => {
72 context.finishForegroundJob(jobId)
73
74 return result
75 })
76 .catch(error => {
77 context.finishForegroundJob(jobId)
78
79 return Promise.reject(error)
80 })
81 }
82 }
83}
84
85module.exports = new WorkQueue()

Callers 2

documents.jsFile · 0.80
workQueue.jsFile · 0.80

Calls 2

startForegroundJobMethod · 0.80
finishForegroundJobMethod · 0.80

Tested by

no test coverage detected