mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-05 08:46:56 +08:00
tiny fixes
This commit is contained in:
@@ -35,6 +35,7 @@ type Connection struct {
|
||||
multiState bool
|
||||
queue [][][]byte
|
||||
watching map[string]uint32
|
||||
txErrors []error
|
||||
|
||||
// selected db
|
||||
selectedDB int
|
||||
@@ -65,11 +66,9 @@ func (c *Connection) Write(b []byte) error {
|
||||
if len(b) == 0 {
|
||||
return nil
|
||||
}
|
||||
c.mu.Lock()
|
||||
c.waitingReply.Add(1)
|
||||
defer func() {
|
||||
c.waitingReply.Done()
|
||||
c.mu.Unlock()
|
||||
}()
|
||||
|
||||
_, err := c.conn.Write(b)
|
||||
@@ -151,6 +150,16 @@ func (c *Connection) EnqueueCmd(cmdLine [][]byte) {
|
||||
c.queue = append(c.queue, cmdLine)
|
||||
}
|
||||
|
||||
// AddTxError stores syntax error within transaction
|
||||
func (c *Connection) AddTxError(err error) {
|
||||
c.txErrors = append(c.txErrors, err)
|
||||
}
|
||||
|
||||
// GetTxErrors returns syntax error within transaction
|
||||
func (c *Connection) GetTxErrors() []error {
|
||||
return c.txErrors
|
||||
}
|
||||
|
||||
// ClearQueuedCmds clears queued commands of current transaction
|
||||
func (c *Connection) ClearQueuedCmds() {
|
||||
c.queue = nil
|
||||
|
Reference in New Issue
Block a user