Skip to content

Commit 06562f0

Browse files
Added duration for transactions
1 parent 59e68fa commit 06562f0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/scheduler/fcfs/fcfs.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package fcfs
33
import (
44
"context"
55
"runtime"
6+
"time"
67

78
"go.uber.org/zap"
89

@@ -92,9 +93,12 @@ func (f *FCFSScheduler) Run(ctx context.Context) error {
9293

9394
/* we assume the transaction has been processed -> updated Redis */
9495
transaction.Status = types.StatusSuccess
96+
97+
/* update duration of transaction execution */
98+
elapsed := time.Since(transaction.Timestamp)
99+
transaction.DurationMs = elapsed.Milliseconds()
95100

96101
/* this whole code snippet should be called "Update Session State after transaction execution" */
97-
98102
/* update the session's completed/failed count */
99103
curSession.Mutex.Lock()
100104
if transaction.ExecStatus {

0 commit comments

Comments
 (0)