this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: Add index so /stats endpoint is much faster

+12 -7
+2 -2
internal/data/store.go
··· 8 8 type IRCLink struct { 9 9 ID int `json:"ircLinkID" gorm:"column:ircLinkID;primaryKey"` 10 10 Timestamp time.Time `json:"timestamp" gorm:"column:timestamp"` 11 - User string `json:"user" gorm:"column:user"` 11 + User string `json:"user" gorm:"column:user;index"` 12 12 Title string `json:"title" gorm:"column:title"` 13 13 URL string `json:"url" gorm:"column:url"` 14 14 Clicks int `json:"clicks" gorm:"column:clicks;default:0"` ··· 38 38 ID int `json:"quoteID" gorm:"column:quoteID;primaryKey"` 39 39 Timestamp time.Time `json:"timestamp" gorm:"column:timestamp"` 40 40 Quote string `json:"quote" gorm:"column:quote"` 41 - Author string `json:"author" gorm:"column:author"` 41 + Author string `json:"author" gorm:"column:author;type:varchar(255);index"` 42 42 } 43 43 44 44 // TableName overrides the table name used by User to `quote`
+6 -5
internal/handler/preview.go
··· 40 40 AuthorURL string `json:"author_url"` 41 41 ProviderName string `json:"provider_name"` 42 42 ProviderURL string `json:"provider_url"` 43 - CacheAge int64 `json:"cache_age"` 43 + 44 + // CacheAge int64 `json:"cache_age"` 44 45 ThumbnailURL string `json:"thumbnail_url"` 45 46 ThumbnailW int `json:"thumbnail_width"` 46 47 ThumbnailH int `json:"thumbnail_height"` 47 48 HTML string `json:"html"` 48 - Width int `json:"width"` 49 - Height int `json:"height"` 50 - Description string `json:"description"` // Non-standard but common 51 - URL string `json:"url"` // Required for type=photo 49 + // Width int `json:"width"` 50 + // Height int `json:"height"` 51 + Description string `json:"description"` // Non-standard but common 52 + URL string `json:"url"` // Required for type=photo 52 53 } 53 54 54 55 // OGPreviewHandler handles /ogpreview.cgi
+2
sql/mysql/000002_add_stats_indexes.up.sql
··· 1 + CREATE INDEX idx_irclink_user ON ircLink(user); 2 + CREATE INDEX idx_quote_author ON quote(author);
+2
sql/sqlite/000002_add_stats_indexes.up.sql
··· 1 + CREATE INDEX IF NOT EXISTS idx_irclink_user ON ircLink(user); 2 + CREATE INDEX IF NOT EXISTS idx_quote_author ON quote(author);