check for maxTimeout to be positive
Signed-off-by: akhilac1 <chetlapalle.akhila@gmail.com>
This commit is contained in:
parent
90ba8a441d
commit
b03c77f2d6
|
@ -58,7 +58,7 @@ const (
|
||||||
unlistenTemplate = "unlisten %s"
|
unlistenTemplate = "unlisten %s"
|
||||||
payloadDataKey = "data"
|
payloadDataKey = "data"
|
||||||
ErrorMissingTableName = "missing postgreSQL configuration table name"
|
ErrorMissingTableName = "missing postgreSQL configuration table name"
|
||||||
ErrorMissingTable = "postgreSQL configuration table - '%v' does not exist"
|
ErrorMissingTable = "postgreSQL configuration table - '%s' does not exist"
|
||||||
InfoStartInit = "initializing postgreSQL configuration store"
|
InfoStartInit = "initializing postgreSQL configuration store"
|
||||||
ErrorMissingConnectionString = "missing postgreSQL connection string"
|
ErrorMissingConnectionString = "missing postgreSQL connection string"
|
||||||
ErrorAlreadyInitialized = "postgreSQL configuration store already initialized"
|
ErrorAlreadyInitialized = "postgreSQL configuration store already initialized"
|
||||||
|
@ -203,9 +203,9 @@ func (p *ConfigurationStore) Unsubscribe(ctx context.Context, req *configuration
|
||||||
return fmt.Errorf("error listening to channel: %s", err)
|
return fmt.Errorf("error listening to channel: %s", err)
|
||||||
}
|
}
|
||||||
delete(p.ActiveSubscriptions, k)
|
delete(p.ActiveSubscriptions, k)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unable to find subscription with ID : %v", req.ID)
|
return fmt.Errorf("unable to find subscription with ID : %v", req.ID)
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ func parseMetadata(cmetadata configuration.Metadata) (metadata, error) {
|
||||||
}
|
}
|
||||||
// configure maxTimeout if provided
|
// configure maxTimeout if provided
|
||||||
if mxTimeout, ok := cmetadata.Properties[connMaxIdleTimeKey]; ok && mxTimeout != "" {
|
if mxTimeout, ok := cmetadata.Properties[connMaxIdleTimeKey]; ok && mxTimeout != "" {
|
||||||
if t, err := time.ParseDuration(mxTimeout); err == nil {
|
if t, err := time.ParseDuration(mxTimeout); err == nil && t > 0 {
|
||||||
m.maxIdleTimeout = t
|
m.maxIdleTimeout = t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,9 +98,7 @@ func TestConnectAndQuery(t *testing.T) {
|
||||||
rows := mock.QueryRow(context.Background(), query)
|
rows := mock.QueryRow(context.Background(), query)
|
||||||
var id string
|
var id string
|
||||||
err = rows.Scan(&id)
|
err = rows.Scan(&id)
|
||||||
if err != nil {
|
assert.Nil(t, err)
|
||||||
t.Error(err)
|
|
||||||
}
|
|
||||||
err = mock.ExpectationsWereMet()
|
err = mock.ExpectationsWereMet()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue