Skip to content

Commit

Permalink
remove the env
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik committed Nov 16, 2023
1 parent b230e62 commit 9faf556
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
1 change: 0 additions & 1 deletion .github/workflows/flow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,3 @@ jobs:
PEERDB_CATALOG_PASSWORD: postgres
PEERDB_CATALOG_DATABASE: postgres
PEERDB_CDC_IDLE_TIMEOUT_SECONDS: 3
PEERDB_ENVIRONMENT: test
6 changes: 3 additions & 3 deletions flow/connectors/postgres/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (p *PostgresCDCSource) consumeStream(
var ctx context.Context
var cancel context.CancelFunc

if len(localRecords) == 0 {
if len(localRecords) == 0 && !receivedPKM {
// if length of localRecords is 0, then we are waiting for the first record
// indefinitely. So we should not timeout.
ctx, cancel = context.WithCancel(p.ctx)
Expand All @@ -256,8 +256,8 @@ func (p *PostgresCDCSource) consumeStream(
cancel()
if err != nil && !p.commitLock {
if pgconn.Timeout(err) {
log.Infof("Idle timeout reached")
if utils.IsTestEnv() || receivedPKM || len(localRecords) > 0 {
log.Infof("Idle timeout of %d seconds reached", standbyMessageTimeout/time.Second)
if receivedPKM || len(localRecords) > 0 {
log.Infof("Returning currently accumulated records - %d", len(localRecords))
return nil
} else {
Expand Down
20 changes: 0 additions & 20 deletions flow/connectors/utils/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,3 @@ func GetEnvInt(name string, defaultValue int) int {

return i
}

// GetEnvString returns the value of the environment variable with the given
// name or defaultValue if the environment variable is not set.
func GetEnvString(name string, defaultValue string) string {
val, ok := GetEnv(name)
if !ok {
return defaultValue
}

return val
}

func IsTestEnv() bool {
envVal := GetEnvString("PEERDB_ENVIRONMENT", "")
if envVal == "test" {
return true
} else {
return false
}
}

0 comments on commit 9faf556

Please sign in to comment.