Skip to content

Commit e8b0edf

Browse files
added context cancellation
1 parent 7c2994d commit e8b0edf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/transprocessor/remotetxn.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ func (p *PermProcessor) HandleRemoteTransaction(host string, port int, txn *type
4747
}
4848

4949
/* MAKE IT CONFIGURABLE */
50-
ctx, _ := context.WithTimeout(context.Background(), 10 * time.Minute)
50+
ctx, cancel := context.WithTimeout(context.Background(), 10 * time.Minute)
5151

5252
aclClient := protos.NewACLServiceClient(conn)
5353
aclResponse, err := aclClient.ApplyACLEntry(ctx, request)
5454
if err != nil || aclResponse == nil {
5555
p.errCh <- fmt.Errorf("failed to send ACL request to daemon")
56+
cancel()
57+
return err
5658
}
5759

5860
if aclResponse.Success {
@@ -70,5 +72,6 @@ func (p *PermProcessor) HandleRemoteTransaction(host string, port int, txn *type
7072
txn.ErrorMsg = "ACL failed to get executed in the filesystem server"
7173
}
7274

75+
cancel()
7376
return nil
7477
}

0 commit comments

Comments
 (0)