From b51321ff9945c35dead3059b78162cd1c1eb4671 Mon Sep 17 00:00:00 2001 From: ssilagadze Date: Wed, 13 Dec 2023 10:52:40 +0100 Subject: [PATCH] fix syntax in query --- metamorph/callbacker.go | 2 +- metamorph/store/dynamodb/dynamodb.go | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/metamorph/callbacker.go b/metamorph/callbacker.go index f22e744cd..fbf3e7a73 100644 --- a/metamorph/callbacker.go +++ b/metamorph/callbacker.go @@ -75,7 +75,7 @@ func SendCallback(logger *slog.Logger, s store.MetamorphStore, tx *store.StoreDa err = s.RemoveCallbacker(context.Background(), tx.Hash) if err != nil { logger.Error("Couldn't update/remove callback url - ", err) - continue + return } return } diff --git a/metamorph/store/dynamodb/dynamodb.go b/metamorph/store/dynamodb/dynamodb.go index 7d430d369..0c89d8643 100644 --- a/metamorph/store/dynamodb/dynamodb.go +++ b/metamorph/store/dynamodb/dynamodb.go @@ -30,6 +30,7 @@ const ( rejectReasonAttributeKey = ":reject_reason" announcedAtAttributeKey = ":announced_at" minedAtAttributeKey = ":mined_at" + callbackUrl = ":callback_url" ) type DynamoDB struct { @@ -518,15 +519,15 @@ func (ddb *DynamoDB) RemoveCallbacker(ctx context.Context, hash *chainhash.Hash) span, _ := opentracing.StartSpanFromContext(ctx, "sql:RemoveCallbacker") defer span.Finish() - updateExpression := "SET callback_url = ''" - - // update tx _, err := ddb.client.UpdateItem(ctx, &dynamodb.UpdateItemInput{ TableName: aws.String(ddb.transactionsTableName), Key: map[string]types.AttributeValue{ "tx_hash": &types.AttributeValueMemberB{Value: hash.CloneBytes()}, }, - UpdateExpression: aws.String(updateExpression), + UpdateExpression: aws.String("SET callback_url = :callback_url"), + ExpressionAttributeValues: map[string]types.AttributeValue{ + callbackUrl: &types.AttributeValueMemberS{Value: ""}, + }, }) if err != nil {