blog style improvements; fix connection pool drain
This commit is contained in:
parent
0a75216aaf
commit
1d98a6fdca
8 changed files with 51 additions and 24 deletions
|
|
@ -26,6 +26,7 @@ func GetBlogPost(db *sqlx.DB, id string) (*model.BlogPost, error) {
|
|||
if strings.Contains(err.Error(), "no rows") { return nil, nil }
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
blueskyActor := sql.NullString{}
|
||||
blueskyRecord := sql.NullString{}
|
||||
|
|
@ -84,6 +85,7 @@ func GetBlogPosts(db *sqlx.DB, onlyVisible bool, limit int, offset int) ([]*mode
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
for rows.Next() {
|
||||
blog := model.BlogPost{}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
const BSKY_API_BASE = "https://public.api.bsky.app"
|
||||
|
||||
func FetchThreadViewPost(actorID string, recordID string) (*model.ThreadViewPost, error) {
|
||||
func FetchThreadViewPost(app *model.AppState, actorID string, recordID string) (*model.ThreadViewPost, error) {
|
||||
uri := fmt.Sprintf("at://%s/app.bsky.feed.post/%s", actorID, recordID)
|
||||
|
||||
req, err := http.NewRequest(
|
||||
|
|
@ -24,7 +24,7 @@ func FetchThreadViewPost(actorID string, recordID string) (*model.ThreadViewPost
|
|||
req.URL.RawQuery = url.Values{
|
||||
"uri": { uri },
|
||||
}.Encode()
|
||||
req.Header.Set("User-Agent", "ari melody [https://arimelody.me]")
|
||||
req.Header.Set("User-Agent", fmt.Sprintf("ari melody [%s]", app.Config.BaseUrl))
|
||||
req.Header.Set("Accept", "application/json")
|
||||
|
||||
client := &http.Client{}
|
||||
|
|
|
|||
|
|
@ -339,6 +339,7 @@ func GetReleaseCredits(db *sqlx.DB, releaseID string) ([]*model.Credit, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
var credits []*model.Credit
|
||||
for rows.Next() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue