fix: reduce Meilisearch load, debounce federation sync (#1012)
* optimize meili trail index * several fixes --------- Co-authored-by: Flomp <Flomp@users.noreply.github.com>
This commit is contained in:
@@ -51,8 +51,17 @@ func RemoteListGet(e *core.RequestEvent) error {
|
||||
}
|
||||
} else {
|
||||
updatedAt := record.GetDateTime("updated").Time()
|
||||
if time.Now().UTC().Sub(updatedAt) > 60*time.Minute {
|
||||
go performFullListSync(e.App, ctx, e.Request.URL, record)
|
||||
|
||||
iri := record.GetString("iri")
|
||||
if time.Now().UTC().Sub(updatedAt) > remoteSyncThreshold {
|
||||
if _, alreadySyncing := listSyncing.LoadOrStore(iri, struct{}{}); !alreadySyncing {
|
||||
urlCopy := *e.Request.URL
|
||||
bgCtx := context.WithValue(context.Background(), "actor", ctx.Value("actor"))
|
||||
go func() {
|
||||
defer listSyncing.Delete(iri)
|
||||
performFullListSync(e.App, bgCtx, &urlCopy, record)
|
||||
}()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user