MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / commit

Method commit

xenomint/state.go:565–599  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

563}
564
565func (s *State) commit() (err error) {
566 var (
567 start = time.Now()
568
569 lockAcquired, committed, poolCleaned, lockReleased time.Duration
570 )
571
572 defer func() {
573 var fields = log.Fields{}
574 fields["1#lockAcquired"] = float64(lockAcquired.Nanoseconds()) / 1000
575 if committed > 0 {
576 fields["2#committed"] = float64((committed - lockAcquired).Nanoseconds()) / 1000
577 }
578 if poolCleaned > 0 {
579 fields["3#poolCleaned"] = float64((poolCleaned - committed).Nanoseconds()) / 1000
580 }
581 if lockReleased > 0 {
582 fields["4#lockReleased"] = float64((lockReleased - poolCleaned).Nanoseconds()) / 1000
583 }
584 log.WithFields(fields).Debug("Commit duration stat (us)")
585 }()
586
587 s.Lock()
588 defer func() {
589 s.Unlock()
590 lockReleased = time.Since(start)
591 }()
592 lockAcquired = time.Since(start)
593 s.flushHandler()
594 committed = time.Since(start)
595 _ = s.pool.queries
596 s.pool = newPool()
597 poolCleaned = time.Since(start)
598 return
599}
600
601// CommitEx commits the current transaction and returns all the pooled queries.
602func (s *State) CommitEx() (failed []*types.Request, queries []*QueryTracker, err error) {

Callers 5

BenchmarkMuxParallelFunction · 0.45
TestMuxServiceFunction · 0.45
TestStateFunction · 0.45

Calls 4

flushHandlerMethod · 0.95
WithFieldsFunction · 0.92
newPoolFunction · 0.85
DebugMethod · 0.80

Tested by 5

BenchmarkMuxParallelFunction · 0.36
TestMuxServiceFunction · 0.36
TestStateFunction · 0.36