mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
Don't use defer
in a loop
As the body of request isn't used, we can sloe it immediately.
This commit is contained in:
parent
60e1d9e361
commit
736f8b4dac
2 changed files with 2 additions and 2 deletions
|
@ -69,7 +69,7 @@ func (c *Client) SendNotification(feed *model.Feed, entries model.Entries) error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("apprise: unable to send request: %v", err)
|
return fmt.Errorf("apprise: unable to send request: %v", err)
|
||||||
}
|
}
|
||||||
defer response.Body.Close()
|
response.Body.Close()
|
||||||
|
|
||||||
if response.StatusCode >= 400 {
|
if response.StatusCode >= 400 {
|
||||||
return fmt.Errorf("apprise: unable to send a notification: url=%s status=%d", apiEndpoint, response.StatusCode)
|
return fmt.Errorf("apprise: unable to send a notification: url=%s status=%d", apiEndpoint, response.StatusCode)
|
||||||
|
|
|
@ -82,7 +82,7 @@ func (c *Client) SendDiscordMsg(feed *model.Feed, entries model.Entries) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("discord: unable to send request: %v", err)
|
return fmt.Errorf("discord: unable to send request: %v", err)
|
||||||
}
|
}
|
||||||
defer response.Body.Close()
|
response.Body.Close()
|
||||||
|
|
||||||
if response.StatusCode >= 400 {
|
if response.StatusCode >= 400 {
|
||||||
return fmt.Errorf("discord: unable to send a notification: url=%s status=%d", c.webhookURL, response.StatusCode)
|
return fmt.Errorf("discord: unable to send a notification: url=%s status=%d", c.webhookURL, response.StatusCode)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue