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

Function onopen

cjs/src/index.js:401–419  ·  view source on GitHub ↗
(c)

Source from the content-addressed store, hash-verified

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