forked from mtusi2026/mtusi2026lab6
refactor(api): stop running reconciler inside API
This commit is contained in:
+14
-14
@@ -134,21 +134,21 @@ func main() {
|
||||
|
||||
srv := &http.Server{Addr: addr, Handler: router}
|
||||
|
||||
reconcilerCtx, reconcilerCancel := context.WithCancel(context.Background())
|
||||
defer reconcilerCancel()
|
||||
if cfg.ReconcilerEnabled {
|
||||
reconciler := service.NewReconciler(
|
||||
store.Attachments(),
|
||||
objectStorage,
|
||||
store.Outbox(),
|
||||
pool,
|
||||
cfg.ReconcilerGracePeriod,
|
||||
)
|
||||
go reconciler.Run(reconcilerCtx, cfg.ReconcilerInterval)
|
||||
}
|
||||
// reconcilerCtx, reconcilerCancel := context.WithCancel(context.Background())
|
||||
// defer reconcilerCancel()
|
||||
// if cfg.ReconcilerEnabled {
|
||||
// reconciler := service.NewReconciler(
|
||||
// store.Attachments(),
|
||||
// objectStorage,
|
||||
// store.Outbox(),
|
||||
// pool,
|
||||
// cfg.ReconcilerGracePeriod,
|
||||
// )
|
||||
// go reconciler.Run(reconcilerCtx, cfg.ReconcilerInterval)
|
||||
// }
|
||||
|
||||
go func() {
|
||||
log.Printf("Запускаем на %s (SESSION_STORE=%s, RECONCILER_ENABLED=%v)", addr, cfg.SessionStore, cfg.ReconcilerEnabled)
|
||||
log.Printf("Запускаем на %s (SESSION_STORE=%s, RECONCILER_ENABLED=%v)", addr, cfg.SessionStore)
|
||||
if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||
log.Fatalf("Ошибка запуска: %v", err)
|
||||
}
|
||||
@@ -162,7 +162,7 @@ func main() {
|
||||
ready.Store(false)
|
||||
|
||||
outboxCancel()
|
||||
reconcilerCancel()
|
||||
// reconcilerCancel()
|
||||
|
||||
if cfg.ShutdownDrain > 0 {
|
||||
time.Sleep(cfg.ShutdownDrain)
|
||||
|
||||
Reference in New Issue
Block a user