From d586c41ccad765c2263ffb56eb8010c7189bce8b Mon Sep 17 00:00:00 2001 From: Alfred Kamanda Date: Wed, 3 Dec 2025 13:12:24 +0300 Subject: [PATCH] add sleep for 1 second between requests --- handlers/application/mpesa.go | 6 +++++- handlers/application/send.go | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/handlers/application/mpesa.go b/handlers/application/mpesa.go index f3ceded..a1b9e02 100644 --- a/handlers/application/mpesa.go +++ b/handlers/application/mpesa.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "strconv" + "time" "git.defalsify.org/vise.git/resource" "git.grassecon.net/grassrootseconomics/common/hex" @@ -411,7 +412,10 @@ func (h *MenuHandlers) InitiateGetMpesa(ctx context.Context, sym string, input [ return res, nil } - logg.InfoCtxf(ctx, "poolSwap", "swapTrackingId", poolSwap.TrackingId) + logg.InfoCtxf(ctx, "mpesa poolSwap before transfer", "swapTrackingId", poolSwap.TrackingId) + + // TODO: remove this temporary time delay and replace with a swap and send endpoint + time.Sleep(1 * time.Second) finalKshStr, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE) if err != nil { diff --git a/handlers/application/send.go b/handlers/application/send.go index 15751e1..538f977 100644 --- a/handlers/application/send.go +++ b/handlers/application/send.go @@ -6,6 +6,7 @@ import ( "fmt" "strconv" "strings" + "time" "git.defalsify.org/vise.git/db" "git.defalsify.org/vise.git/resource" @@ -842,7 +843,10 @@ func (h *MenuHandlers) TransactionInitiateSwap(ctx context.Context, sym string, } swapTrackingId := poolSwap.TrackingId - logg.InfoCtxf(ctx, "poolSwap", "swapTrackingId", swapTrackingId) + logg.InfoCtxf(ctx, "send poolSwap before transfer", "swapTrackingId", swapTrackingId) + + // TODO: remove this temporary time delay and replace with a swap and send endpoint + time.Sleep(1 * time.Second) // Initiate a send recipientPublicKey, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_RECIPIENT) @@ -874,7 +878,7 @@ func (h *MenuHandlers) TransactionInitiateSwap(ctx context.Context, sym string, } trackingId := tokenTransfer.TrackingId - logg.InfoCtxf(ctx, "TokenTransfer", "trackingId", trackingId) + logg.InfoCtxf(ctx, "send TokenTransfer after swap", "trackingId", trackingId) res.Content = l.Get( "Your request has been sent. %s will receive %s %s from %s.",