From 75373418617928ab55b9c6090dbe974dabdb1edd Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Fri, 4 Oct 2024 16:31:02 +0200 Subject: [PATCH] Remove context from dispatch Signed-off-by: Marek Siarkowicz --- server/etcdserver/apply/apply.go | 4 ++-- server/etcdserver/apply/apply_auth_test.go | 2 +- server/etcdserver/apply/uber_applier.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/etcdserver/apply/apply.go b/server/etcdserver/apply/apply.go index 432116c721b..60a2f8f4faa 100644 --- a/server/etcdserver/apply/apply.go +++ b/server/etcdserver/apply/apply.go @@ -62,7 +62,7 @@ type Result struct { Trace *traceutil.Trace } -type applyFunc func(ctx context.Context, r *pb.InternalRaftRequest) *Result +type applyFunc func(r *pb.InternalRaftRequest) *Result // applierV3 is the interface for processing V3 raft messages type applierV3 interface { @@ -147,7 +147,7 @@ func newApplierV3Backend( } func (a *applierV3backend) Apply(r *pb.InternalRaftRequest, applyFunc applyFunc) *Result { - return applyFunc(context.TODO(), r) + return applyFunc(r) } func (a *applierV3backend) Put(ctx context.Context, p *pb.PutRequest) (resp *pb.PutResponse, trace *traceutil.Trace, err error) { diff --git a/server/etcdserver/apply/apply_auth_test.go b/server/etcdserver/apply/apply_auth_test.go index 707c1fa9f93..51f75520380 100644 --- a/server/etcdserver/apply/apply_auth_test.go +++ b/server/etcdserver/apply/apply_auth_test.go @@ -45,7 +45,7 @@ func dummyIndexWaiter(_ uint64) <-chan struct{} { return ch } -func dummyApplyFunc(_ context.Context, _ *pb.InternalRaftRequest) *Result { +func dummyApplyFunc(_ *pb.InternalRaftRequest) *Result { return &Result{} } diff --git a/server/etcdserver/apply/uber_applier.go b/server/etcdserver/apply/uber_applier.go index d8e9503669a..15fc7f59c7f 100644 --- a/server/etcdserver/apply/uber_applier.go +++ b/server/etcdserver/apply/uber_applier.go @@ -120,7 +120,8 @@ func (a *uberApplier) Apply(r *pb.InternalRaftRequest) *Result { // dispatch translates the request (r) into appropriate call (like Put) on // the underlying applyV3 object. -func (a *uberApplier) dispatch(ctx context.Context, r *pb.InternalRaftRequest) *Result { +func (a *uberApplier) dispatch(r *pb.InternalRaftRequest) *Result { + ctx := context.TODO() op := "unknown" ar := &Result{} defer func(start time.Time) {