Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mattisonchao committed Nov 15, 2024
1 parent b2db6b8 commit 0902e24
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/leader_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ func (lc *leaderController) WriteStream(stream proto.OxiaClient_WriteStreamServe
}
}

//nolint:cognitive-complexity
// nolint:cognitive-complexity
func (lc *leaderController) handleWriteStream(closeStreamSignal chan error, stream proto.OxiaClient_WriteStreamServer) {

Check failure on line 895 in server/leader_controller.go

View workflow job for this annotation

GitHub Actions / Build & Test

cognitive-complexity: function (*leaderController).handleWriteStream has cognitive complexity 23 (> max enabled 15) (revive)
lastCallbackError := atomic.Pointer[error]{}
for {
Expand All @@ -911,27 +911,27 @@ func (lc *leaderController) handleWriteStream(closeStreamSignal chan error, stre
slog.Debug("Got request in stream", slog.Any("req", writeRequest))
lc.appendToWalStreamRequest(writeRequest, func(offset int64, timestamp uint64, err error) {
if err != nil {
latencyTimer.Done()
latencyTimer.Done() // nolint:contextcheck
slog.Debug("Got an error when write to wal", slog.Any("error", err))
lastCallbackError.Store(&err)
return
}
lc.quorumAckTracker.WaitForCommitOffsetAsync(stream.Context(), offset, func(_ context.Context, innerErr error) {
if innerErr != nil {
latencyTimer.Done()
latencyTimer.Done() // nolint:contextcheck
slog.Debug("Got an error when commit async", slog.Any("error", err))
lastCallbackError.Store(&err)
return
}
var writeResponse *proto.WriteResponse
if writeResponse, err = lc.db.ProcessWrite(writeRequest, offset, timestamp, WrapperUpdateOperationCallback); err != nil {
latencyTimer.Done()
latencyTimer.Done() // nolint:contextcheck
slog.Debug("Got an error when write to DB", slog.Any("error", err))
lastCallbackError.Store(&err)
return
}
if err = stream.Send(writeResponse); err != nil {
latencyTimer.Done()
latencyTimer.Done() // nolint:contextcheck
slog.Debug("Got an error when write response to client", slog.Any("error", err))
lastCallbackError.Store(&err)
return
Expand Down

0 comments on commit 0902e24

Please sign in to comment.