From 144219f0aab251b038d043255517bb8e4d3ce379 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 27 Jan 2025 15:53:34 +0800 Subject: [PATCH] :bug: Fix nats option durable set more than once --- pkg/internal/services/factors.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/internal/services/factors.go b/pkg/internal/services/factors.go index 4b8ad1b..08528a9 100644 --- a/pkg/internal/services/factors.go +++ b/pkg/internal/services/factors.go @@ -119,13 +119,13 @@ func CheckFactor(factor models.AuthFactor, code string) error { ) case models.EmailPasswordFactor: identifier := fmt.Sprintf("%s%d", gap.FactorOtpPrefix, factor.ID) - sub, err := gap.Jt.PullSubscribe(identifier, "otp_consumer", nats.Durable("otp_consumer")) + sub, err := gap.Jt.PullSubscribe(identifier, "otp_validator") if err != nil { log.Error().Err(err).Msg("Error subscribing to subject when validating factor code...") return fmt.Errorf("error subscribing to subject: %v", err) } - msgs, err := sub.Fetch(1, nats.MaxWait(2*time.Second)) + msgs, err := sub.Fetch(1, nats.MaxWait(3*time.Second)) if err != nil { log.Error().Err(err).Msg("Error fetching message when validating factor code...") return fmt.Errorf("error fetching message: %v", err)