Skip to content

Commit 4ab6498

Browse files
Updated code for updating status of the session in Redis and session itself
1 parent 838edb0 commit 4ab6498

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

internal/scheduler/fcfs/fcfs.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ func (f *FCFSScheduler) Run(ctx context.Context) error {
9393
/* we assume the transaction has been processed -> updated Redis */
9494
transaction.Status = types.StatusSuccess
9595

96+
/* this whole code snippet should be called "Update Session State after transaction execution" */
97+
98+
/* update the session's completed/failed count */
99+
curSession.Mutex.Lock()
100+
if transaction.ExecStatus {
101+
curSession.CompletedCount++
102+
f.curSessionManager.IncrementSessionCompletedRedis(curSession)
103+
} else {
104+
curSession.FailedCount++
105+
f.curSessionManager.IncrementSessionFailedRedis(curSession)
106+
}
107+
curSession.Mutex.Unlock()
108+
96109
/* store the result of processed transaction into Redis */
97110
f.curSessionManager.SaveTransactionRedisList(curSession, transaction, "txresults")
98111

0 commit comments

Comments
 (0)