mirror of
https://github.com/go-shiori/shiori.git
synced 2025-02-22 06:53:22 +08:00
Fix wrong mutex
This commit is contained in:
parent
dd2c302153
commit
124c2845e9
1 changed files with 3 additions and 3 deletions
|
@ -81,6 +81,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateBookmarks(indices []string, url, title, excerpt string, tags []string, offline bool) ([]model.Bookmark, error) {
|
func updateBookmarks(indices []string, url, title, excerpt string, tags []string, offline bool) ([]model.Bookmark, error) {
|
||||||
|
mutex := sync.Mutex{}
|
||||||
// Read bookmarks from database
|
// Read bookmarks from database
|
||||||
bookmarks, err := DB.GetBookmarks(db.GetBookmarksOptions{WithContents: true}, indices...)
|
bookmarks, err := DB.GetBookmarks(db.GetBookmarksOptions{WithContents: true}, indices...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -97,12 +98,11 @@ func updateBookmarks(indices []string, url, title, excerpt string, tags []string
|
||||||
|
|
||||||
// If not offline, fetch articles from internet
|
// If not offline, fetch articles from internet
|
||||||
if !offline {
|
if !offline {
|
||||||
mutex := sync.Mutex{}
|
|
||||||
waitGroup := sync.WaitGroup{}
|
waitGroup := sync.WaitGroup{}
|
||||||
|
|
||||||
for i, book := range bookmarks {
|
for i, book := range bookmarks {
|
||||||
|
waitGroup.Add(1)
|
||||||
|
|
||||||
go func(pos int, book model.Bookmark) {
|
go func(pos int, book model.Bookmark) {
|
||||||
waitGroup.Add(1)
|
|
||||||
defer waitGroup.Done()
|
defer waitGroup.Done()
|
||||||
|
|
||||||
article, err := readability.Parse(book.URL, 10*time.Second)
|
article, err := readability.Parse(book.URL, 10*time.Second)
|
||||||
|
|
Loading…
Reference in a new issue