Skip to content

Commit b55c02d

Browse files
Implemented transaction execution via remote daemons on fcfs
1 parent e6af242 commit b55c02d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

internal/scheduler/fcfs/fcfs.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ func (f *FCFSScheduler) Run(ctx context.Context) error {
6767
}
6868

6969
/* get a transaction from the session to process */
70-
transaction := curSession.TransactionQueue.Remove(curSession.TransactionQueue.Front())
70+
transaction := curSession.TransactionQueue.Remove(curSession.TransactionQueue.Front()).(*types.Transaction)
7171
curSession.Mutex.Unlock()
7272

7373
/* block if all workers are busy */
7474
f.semaphore <- struct{}{}
7575

7676
/* go routine is available to be spawned */
77-
go func(curSession *session.Session, transaction types.Transaction) {
77+
go func(curSession *session.Session, transaction *types.Transaction) {
7878
/* defer clearing the semaphore channel */
7979
defer func() { <-f.semaphore }()
8080

@@ -89,7 +89,11 @@ func (f *FCFSScheduler) Run(ctx context.Context) error {
8989
zap.Error(err),
9090
)
9191
}
92-
}(curSession, transaction.(types.Transaction))
92+
93+
/* we assume the transaction has been processed -> updated Redis */
94+
transaction.Status = types.StatusSuccess
95+
f.curSessionManager.SaveTransactionResultsRedis(curSession, transaction, "txresults")
96+
}(curSession, transaction)
9397
}
9498
}
9599
}

0 commit comments

Comments
 (0)