package sync import ( "context" "log" ) // SyncAllEntities enqueues sync jobs for all entity types. func (s *SyncJob) SyncAllEntities(ctx context.Context) error { log.Println("Enqueueing entity sync jobs...") entityTypes := []string{ "Work", "Translation", "TopicCluster", "Emotion", "Embedding", "Gamification", "Contribution", "Stats", "LanguageAnalysis", "WritingStyle", "Media", "Collection", "Bookmark", "Word", "Copyright", "Admin", "Author", "Category", "User", "Book", "Source", "Tag", "Concept", "Comment", "ReadabilityScore", "LanguageEntity", "Vote", "Edition", "LinguisticLayer", "Mood", "Like", "Notification", "EditorialWorkflow", "Monetization", "Country", "City", "Address", "WorkStats", "TranslationStats", "MediaStats", "UserStats", "Place", "BookStats", "CollectionStats", "TextMetadata", "PoeticAnalysis", "HybridEntityWork", "CopyrightClaim", "Contributor", // Edge is handled separately in SyncAllEdges } for _, entityType := range entityTypes { if err := EnqueueEntitySync(s.AsynqClient, entityType); err != nil { log.Printf("Error enqueueing entity sync job for %s: %v", entityType, err) } else { log.Printf("Enqueued entity sync job for %s", entityType) } } log.Println("Entity sync jobs enqueued successfully.") return nil } // syncEntities is a generic function to sync a given entity type. func (s *SyncJob) syncEntities(className string, ctx context.Context) error { batchProcessor := NewBatchProcessor(s.DB, s.Cfg, s.WeaviateClient) return batchProcessor.ProcessAllEntities(ctx, className) }