From 040e3b59ab759185476c9fff043e849c82eb38c5 Mon Sep 17 00:00:00 2001 From: Gurjot Singh <111540954+gusin13@users.noreply.github.com> Date: Fri, 6 Dec 2024 13:54:00 +0530 Subject: [PATCH] fix timeout (#175) --- internal/shared/db/model/setup.go | 4 ++-- internal/v2/queue/handler/stats.go | 2 +- internal/v2/queue/queue.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/shared/db/model/setup.go b/internal/shared/db/model/setup.go index 62420e6..d2516cb 100644 --- a/internal/shared/db/model/setup.go +++ b/internal/shared/db/model/setup.go @@ -59,9 +59,9 @@ var collections = map[string][]index{ V1BtcInfoCollection: {{Indexes: map[string]int{}}}, // V2 V2StatsLockCollection: {{Indexes: map[string]int{}}}, - V2StakerStatsCollection: {{Indexes: map[string]int{}}}, - V2FinalityProviderStatsCollection: {{Indexes: map[string]int{"active_tvl": -1}, Unique: false}}, V2OverallStatsCollection: {{Indexes: map[string]int{}}}, + V2FinalityProviderStatsCollection: {{Indexes: map[string]int{"active_tvl": -1}, Unique: false}}, + V2StakerStatsCollection: {{Indexes: map[string]int{"active_tvl": -1}, Unique: false}}, } func Setup(ctx context.Context, cfg *config.Config) error { diff --git a/internal/v2/queue/handler/stats.go b/internal/v2/queue/handler/stats.go index 7f9b0dc..4a29705 100644 --- a/internal/v2/queue/handler/stats.go +++ b/internal/v2/queue/handler/stats.go @@ -23,7 +23,7 @@ func (h *V2QueueHandler) ActiveStakingHandler(ctx context.Context, messageBody s // Mark as v1 delegation as transitioned if it exists if err := h.Services.V2Service.MarkV1DelegationAsTransitioned(ctx, activeStakingEvent.StakingTxHashHex); err != nil { log.Ctx(ctx).Error().Err(err).Msg("Failed to mark v1 delegation as transitioned") - return err + return types.NewError(http.StatusInternalServerError, types.InternalServiceError, err) } // TODO: Perform the address lookup conversion diff --git a/internal/v2/queue/queue.go b/internal/v2/queue/queue.go index 0deda0d..81af62a 100644 --- a/internal/v2/queue/queue.go +++ b/internal/v2/queue/queue.go @@ -43,7 +43,7 @@ func New(cfg *queueConfig.QueueConfig, service *services.Services) *Queues { handlers := v2queuehandler.NewV2QueueHandler(service) return &Queues{ Handlers: handlers, - processingTimeout: time.Duration(cfg.QueueProcessingTimeout) * time.Second, + processingTimeout: cfg.QueueProcessingTimeout, maxRetryAttempts: cfg.MsgMaxRetryAttempts, ActiveStakingQueueClient: activeStakingQueueClient, UnbondingStakingQueueClient: unbondingStakingQueueClient,