mirror of
https://github.com/wgh136/nysoure.git
synced 2025-12-15 23:41:16 +00:00
feat: add logging for search index rebuilding progress
This commit is contained in:
@@ -3,6 +3,7 @@ package search
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"nysoure/server/dao"
|
||||
"nysoure/server/model"
|
||||
"nysoure/server/utils"
|
||||
@@ -63,6 +64,7 @@ func createIndex() error {
|
||||
}
|
||||
page := 1
|
||||
total := 1
|
||||
current := 0
|
||||
for page <= total {
|
||||
res, totalPages, err := dao.GetResourceList(page, 100, model.RSortTimeAsc)
|
||||
if err != nil {
|
||||
@@ -73,6 +75,10 @@ func createIndex() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
current++
|
||||
if current%20 == 0 {
|
||||
slog.Info("Rebuilding search index", "current", current, "total", totalPages*100)
|
||||
}
|
||||
}
|
||||
page++
|
||||
total = totalPages
|
||||
|
||||
Reference in New Issue
Block a user