Skip to content

Commit

Permalink
renamed newChannel variable to channelEncoded
Browse files Browse the repository at this point in the history
  • Loading branch information
alash3al committed Sep 17, 2022
1 parent c9dfb14 commit b8388ac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internals/datastore/engines/postgresql/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ func (e *Engine) Close() error {

// Publish submits the payload to the specified channel
func (e *Engine) Publish(channel []byte, payload []byte) error {
newChannel := fmt.Sprintf("%x", md5.Sum(channel))
if _, err := e.conn.Exec(context.Background(), "SELECT pg_notify($1, $2)", newChannel, payload); err != nil {
channelEncoded := fmt.Sprintf("%x", md5.Sum(channel))
if _, err := e.conn.Exec(context.Background(), "SELECT pg_notify($1, $2)", channelEncoded, payload); err != nil {
return err
}

Expand All @@ -291,8 +291,8 @@ func (e *Engine) Subscribe(channel []byte, cb func([]byte) error) error {
return err
}

newChannel := fmt.Sprintf("\"%x\"", md5.Sum(channel))
if _, err := conn.Exec(context.Background(), "LISTEN "+newChannel); err != nil {
channelEncoded := fmt.Sprintf("\"%x\"", md5.Sum(channel))
if _, err := conn.Exec(context.Background(), "LISTEN "+channelEncoded); err != nil {
return fmt.Errorf("database::listen::err %s", err.Error())
}

Expand Down

0 comments on commit b8388ac

Please sign in to comment.