MCPcopy
hub / github.com/fastify/fastify / next

Function next

lib/hooks.js:119–150  ·  view source on GitHub ↗
(err)

Source from the content-addressed store, hash-verified

117 }
118
119 function next (err) {
120 if (err) {
121 exit(err)
122 return
123 }
124
125 if (i === hooks.length && c === server[kChildren].length) {
126 if (i === 0 && c === 0) { // speed up start
127 exit()
128 } else {
129 // This is the last function executed for every fastify instance
130 boot(function manageTimeout (err, done) {
131 // this callback is needed by fastify to provide an hook interface without the error
132 // as first parameter and managing it on behalf the user
133 exit(err)
134
135 // this callback is needed by avvio to continue the loading of the next `register` plugins
136 done(err)
137 })
138 }
139 return
140 }
141
142 if (i === hooks.length && c < server[kChildren].length) {
143 const child = server[kChildren][c++]
144 hookRunnerApplication(hookName, boot, child, next)
145 return
146 }
147
148 boot(wrap(hooks[i++], server))
149 next()
150 }
151
152 function wrap (fn, server) {
153 return function (err, done) {

Callers 15

hookRunnerApplicationFunction · 0.85
onListenHookRunnerFunction · 0.85
handleResolveFunction · 0.85
hookRunnerGeneratorFunction · 0.85
onSendHookRunnerFunction · 0.85
preParsingHookRunnerFunction · 0.85
onRequestAbortHookRunnerFunction · 0.85
route.6.test.jsFile · 0.85
route.8.test.jsFile · 0.85
route.7.test.jsFile · 0.85
hooks.test.jsFile · 0.85

Calls 9

exitFunction · 0.85
hookRunnerApplicationFunction · 0.85
onListenHookRunnerFunction · 0.85
cbFunction · 0.85
iteratorFunction · 0.85
errorMethod · 0.80
thenMethod · 0.80
wrapFunction · 0.70
doneFunction · 0.50

Tested by 3

bazInstanceFunction · 0.68
barInstanceFunction · 0.68
fooInstanceFunction · 0.68