mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
fix: a possible crash in event target Close() (#17948)
these are possible crashes when the configured target is still in init() state and never finished - however a delete config was initiated.
This commit is contained in:
parent
b48bbe08b2
commit
0d1fbef751
@ -219,7 +219,9 @@ func (target *MQTTTarget) Save(eventData event.Event) error {
|
|||||||
|
|
||||||
// Close - does nothing and available for interface compatibility.
|
// Close - does nothing and available for interface compatibility.
|
||||||
func (target *MQTTTarget) Close() error {
|
func (target *MQTTTarget) Close() error {
|
||||||
target.client.Disconnect(100)
|
if target.client != nil {
|
||||||
|
target.client.Disconnect(100)
|
||||||
|
}
|
||||||
close(target.quitCh)
|
close(target.quitCh)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,11 @@ func (target *MySQLTarget) Close() error {
|
|||||||
_ = target.insertStmt.Close()
|
_ = target.insertStmt.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.db.Close()
|
if target.db != nil {
|
||||||
|
return target.db.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Executes the table creation statements.
|
// Executes the table creation statements.
|
||||||
|
@ -308,7 +308,11 @@ func (target *PostgreSQLTarget) Close() error {
|
|||||||
_ = target.insertStmt.Close()
|
_ = target.insertStmt.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.db.Close()
|
if target.db != nil {
|
||||||
|
target.db.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Executes the table creation statements.
|
// Executes the table creation statements.
|
||||||
|
@ -273,7 +273,10 @@ func (target *RedisTarget) SendFromStore(eventKey string) error {
|
|||||||
// Close - releases the resources used by the pool.
|
// Close - releases the resources used by the pool.
|
||||||
func (target *RedisTarget) Close() error {
|
func (target *RedisTarget) Close() error {
|
||||||
close(target.quitCh)
|
close(target.quitCh)
|
||||||
return target.pool.Close()
|
if target.pool != nil {
|
||||||
|
return target.pool.Close()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (target *RedisTarget) init() error {
|
func (target *RedisTarget) init() error {
|
||||||
|
Loading…
Reference in New Issue
Block a user