api: Notify events only if bucket notifications are set. (#2293)

While the existing code worked, it went to an entire cycle
of constructing event structure and end up not sending it.

Avoid this in the first place, but returning quickly if
notifications are not set on the bucket.
This commit is contained in:
Harshavardhana
2016-07-26 19:10:02 -07:00
committed by Anand Babu (AB) Periasamy
parent 3054b74260
commit 77248bd6e8
5 changed files with 67 additions and 15 deletions

View File

@@ -39,7 +39,7 @@ func (api objectAPIHandlers) loadNotificationConfig(bucket string) (nConfig noti
if err != nil {
switch err.(type) {
case ObjectNotFound:
return notificationConfig{}, nil
return notificationConfig{}, errNoSuchNotifications
}
return notificationConfig{}, err
}
@@ -48,7 +48,7 @@ func (api objectAPIHandlers) loadNotificationConfig(bucket string) (nConfig noti
if err != nil {
switch err.(type) {
case ObjectNotFound:
return notificationConfig{}, nil
return notificationConfig{}, errNoSuchNotifications
}
return notificationConfig{}, err
}