Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ch05/ch05_05/transact.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func (l *TransactionLogger) ReadEvents() (<-chan Event, <-chan error) {

go func() {
var e Event
var lastSeq uint64 = 0

defer close(outEvent)
defer close(outError)
Expand All @@ -133,7 +134,7 @@ func (l *TransactionLogger) ReadEvents() (<-chan Event, <-chan error) {
line, "%d\t%d\t%s\t%s",
&e.Sequence, &e.EventType, &e.Key, &e.Value)

if l.lastSequence >= e.Sequence {
if lastSeq >= e.Sequence {
outError <- fmt.Errorf("transaction numbers out of sequence")
return
}
Expand All @@ -145,7 +146,7 @@ func (l *TransactionLogger) ReadEvents() (<-chan Event, <-chan error) {
}

e.Value = uv
l.lastSequence = e.Sequence
lastSeq = e.Sequence

outEvent <- e
}
Expand Down