chore: build
This commit is contained in:
+27
-4
@@ -1,7 +1,3 @@
|
||||
// ============================================
|
||||
// main.go - VERSION SIMPLIFIÉE AVEC CLEANUP AUTO
|
||||
// ============================================
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -42,6 +38,13 @@ func main() {
|
||||
geoService := services.NewGeoService(db.Redis, db.RedisCtx)
|
||||
log.Println("✅ Service de géolocalisation initialisé")
|
||||
|
||||
lbService := services.NewLBTelegramService()
|
||||
if lbService.IsConfigured() {
|
||||
log.Println("✅ Service LBTelegram initialisé")
|
||||
} else {
|
||||
log.Println("ℹ️ Service LBTelegram désactivé (LBTELEGRAM_URL non défini)")
|
||||
}
|
||||
|
||||
telegramService := services.NewTelegramService()
|
||||
if telegramService.IsConfigured() {
|
||||
log.Println("✅ Service Telegram initialisé")
|
||||
@@ -69,6 +72,26 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Ré-enrôler tous les comptes déjà liés dans lbtelegram (au cas où lbtelegram a redémarré)
|
||||
if lbService.IsConfigured() {
|
||||
go func() {
|
||||
accounts, err := database.GetAllLinkedTelegramAccounts()
|
||||
if err != nil {
|
||||
log.Printf("⚠️ [LB_SYNC] Erreur lecture comptes liés: %v", err)
|
||||
return
|
||||
}
|
||||
ok, fail := 0, 0
|
||||
for _, a := range accounts {
|
||||
if err := lbService.EnrollUser(a.ChatID, a.Username, a.Role); err != nil {
|
||||
fail++
|
||||
} else {
|
||||
ok++
|
||||
}
|
||||
}
|
||||
log.Printf("✅ [LB_SYNC] Re-enrollment terminé: %d OK, %d échecs (total %d comptes)", ok, fail, len(accounts))
|
||||
}()
|
||||
}
|
||||
|
||||
log.Println("")
|
||||
log.Println("🧹 Démarrage du nettoyage des commandes invalides...")
|
||||
removed, err := database.CleanupInvalidQueueCommands()
|
||||
|
||||
Reference in New Issue
Block a user