MCPcopy Create free account
hub / github.com/porsager/postgres / onopen

Function onopen

cf/src/index.js:402–420  ·  view source on GitHub ↗
(c)

Source from the content-addressed store, hash-verified

400 }
401
402 function onopen(c) {
403 if (queries.length === 0)
404 return move(c, open)
405
406 let max = Math.ceil(queries.length / (connecting.length + 1))
407 , ready = true
408
409 while (ready && queries.length && max-- > 0) {
410 const query = queries.shift()
411 if (query.reserve)
412 return query.reserve(c)
413
414 ready = c.execute(query)
415 }
416
417 ready
418 ? move(c, busy)
419 : move(c, full)
420 }
421
422 function onclose(c, e) {
423 move(c, closed)

Callers 3

reserveFunction · 0.70
drainFunction · 0.70
ReadyForQueryFunction · 0.70

Calls 3

moveFunction · 0.70
reserveMethod · 0.65
executeMethod · 0.65

Tested by

no test coverage detected