Skip to content

Commit 7fe2d1b

Browse files
Updated error handling for fcfs
1 parent 0154038 commit 7fe2d1b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

internal/scheduler/fcfs/fcfs.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,26 @@ func (f *FCFSScheduler) Run(ctx context.Context) error {
103103
curSession.Mutex.Lock()
104104
if transaction.ExecStatus {
105105
curSession.CompletedCount++
106-
f.curSessionManager.IncrementSessionCompletedRedis(curSession)
106+
if err := f.curSessionManager.IncrementSessionCompletedRedis(curSession); err != nil {
107+
zap.L().Error("Failed to increment completed session in Redis")
108+
}
107109
} else {
108110
curSession.FailedCount++
109-
f.curSessionManager.IncrementSessionFailedRedis(curSession)
111+
if err := f.curSessionManager.IncrementSessionFailedRedis(curSession); err != nil {
112+
zap.L().Error("Failed to increment failed session in Redis")
113+
}
110114
}
111115
curSession.Mutex.Unlock()
112116

113117
/* store the result of processed transaction into Redis */
114-
f.curSessionManager.SaveTransactionRedisList(curSession, transaction, "txresults")
118+
if err := f.curSessionManager.SaveTransactionRedisList(curSession, transaction, "txresults"); err != nil {
119+
zap.L().Error("Failed to store processed transaction into Redis")
120+
}
115121

116122
/* remove the transaction as pending from Redis */
117-
f.curSessionManager.RemovePendingTransaction(curSession, transaction.ID)
123+
if err := f.curSessionManager.RemovePendingTransaction(curSession, transaction.ID); err != nil {
124+
zap.L().Error("Failed to remove pending transaction from Redis")
125+
}
118126

119127
}(curSession, transaction)
120128
}

0 commit comments

Comments
 (0)