@@ -11,7 +11,6 @@ import (
1111 "path/filepath"
1212 "strconv"
1313 "strings"
14- "sync"
1514 "time"
1615
1716 wal "github.com/hashicorp/raft-wal"
@@ -39,10 +38,8 @@ type Server struct {
3938 tredsCommandRegistry commands.CommandRegistry
4039 tredsServerCommandRegistry ServerCommandRegistry
4140 clientTransaction map [string ][]string
42- clientTransactionLock * sync.Mutex
4341
4442 channelSubscriptionData * radix.Tree
45- channelSubscriptionLock * sync.Mutex
4643 connectionSubscription map [string ]map [string ]struct {}
4744
4845 connectionMap map [string ]gnet.Conn
@@ -206,10 +203,8 @@ func New(port, segmentSize int, bindAddr, advertiseAddr, serverId string, applyT
206203 id : config .LocalID ,
207204 raftApplyTimeout : applyTimeout ,
208205 clientTransaction : make (map [string ][]string ),
209- clientTransactionLock : & sync.Mutex {},
210206 connP : connPool .NewConnPool (time .Second * 5 ),
211207 channelSubscriptionData : radix .New (),
212- channelSubscriptionLock : & sync.Mutex {},
213208 connectionSubscription : make (map [string ]map [string ]struct {}),
214209 connectionMap : make (map [string ]gnet.Conn ),
215210 }, nil
@@ -276,22 +271,6 @@ func (ts *Server) GetRaftApplyTimeout() time.Duration {
276271 return ts .raftApplyTimeout
277272}
278273
279- func (ts * Server ) LockClientTransaction () {
280- ts .clientTransactionLock .Lock ()
281- }
282-
283- func (ts * Server ) UnlockClientTransaction () {
284- ts .clientTransactionLock .Unlock ()
285- }
286-
287- func (ts * Server ) LockChannelSubs () {
288- ts .channelSubscriptionLock .Lock ()
289- }
290-
291- func (ts * Server ) UnlockChannelSubs () {
292- ts .channelSubscriptionLock .Unlock ()
293- }
294-
295274func (ts * Server ) SetChannelSubscriptionData (data * radix.Tree ) {
296275 ts .channelSubscriptionData = data
297276}
@@ -323,8 +302,6 @@ func (ts *Server) OnTraffic(c gnet.Conn) gnet.Action {
323302
324303 // Check for transaction first, if transaction just enqueue the command
325304 if _ , ok := ts .clientTransaction [c .RemoteAddr ().String ()]; ok {
326- ts .clientTransactionLock .Lock ()
327- defer ts .clientTransactionLock .Unlock ()
328305 ts .clientTransaction [c .RemoteAddr ().String ()] = append (ts .clientTransaction [c .RemoteAddr ().String ()], inp )
329306 res := "QUEUED"
330307 _ , errConn := c .Write ([]byte (resp .EncodeSimpleString (res )))
@@ -428,14 +405,10 @@ func (ts *Server) OnClose(c gnet.Conn, _ error) gnet.Action {
428405}
429406
430407func (ts * Server ) CleanUpClientTransaction (c gnet.Conn ) {
431- ts .clientTransactionLock .Lock ()
432- defer ts .clientTransactionLock .Unlock ()
433408 delete (ts .clientTransaction , c .RemoteAddr ().String ())
434409}
435410
436411func (ts * Server ) CleanUpChannelSubscriptions (c gnet.Conn ) {
437- ts .channelSubscriptionLock .Lock ()
438- defer ts .channelSubscriptionLock .Unlock ()
439412 // use connectionSubscription map to delete all subscriptions for this connection
440413 if _ , ok := ts .connectionSubscription [c .RemoteAddr ().String ()]; ok {
441414 for channel := range ts .connectionSubscription [c .RemoteAddr ().String ()] {
0 commit comments