Skip to content

Commit

Permalink
remove mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Jan 2, 2024
1 parent 7261f6a commit 2b3c17f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions flow/connectors/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"log/slog"
"regexp"
"sync"
"time"

"github.com/PeerDB-io/peer-flow/connectors/utils"
Expand All @@ -28,7 +27,6 @@ type PostgresConnector struct {
config *protos.PostgresConfig
pool *SSHWrappedPostgresPool
replConfig *pgxpool.Config
replMutex sync.Mutex
replPool *SSHWrappedPostgresPool
tableSchemaMapping map[string]*protos.TableSchema
customTypesMapping map[uint32]string
Expand Down Expand Up @@ -91,15 +89,12 @@ func NewPostgresConnector(ctx context.Context, pgConfig *protos.PostgresConfig)
}, nil
}

// nil returns the connection pool.
// GetPool returns the connection pool.
func (c *PostgresConnector) GetPool() *SSHWrappedPostgresPool {
return c.pool
}

func (c *PostgresConnector) GetReplPool(ctx context.Context) (*SSHWrappedPostgresPool, error) {
c.replMutex.Lock()
defer c.replMutex.Unlock()

if c.replPool != nil {
return c.replPool, nil
}
Expand Down

0 comments on commit 2b3c17f

Please sign in to comment.