From 3e3ad81d98d7695aa13a1b219d3c360747969f90 Mon Sep 17 00:00:00 2001 From: yito88 Date: Sun, 14 Apr 2024 00:36:42 +0200 Subject: [PATCH] remove redundant reconnection --- scalardb/src/scalardb/transfer.clj | 4 +--- scalardb/src/scalardb/transfer_append.clj | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scalardb/src/scalardb/transfer.clj b/scalardb/src/scalardb/transfer.clj index 1ece5d7..0fde6db 100644 --- a/scalardb/src/scalardb/transfer.clj +++ b/scalardb/src/scalardb/transfer.clj @@ -117,8 +117,6 @@ "Execute transfers in parallel. Give the transfer function." [test op transfer-fn] (let [results (pmap #(transfer-fn test %) (:value op))] - (when (every? :start-fail results) - (scalar/try-reconnection! test scalar/prepare-transaction-service!)) (if (some #{:commit} results) ;; return :ok when at least 1 transaction is committed (assoc op :type :ok :value {:results results}) @@ -192,7 +190,7 @@ (defn transfer [test _] (let [num-accs (-> test :client :n) - num-txs (inc (rand-int (-> test :client :max-txs)))] + num-txs (-> test :client :max-txs rand-int inc)] {:type :invoke :f :transfer :value (repeatedly num-txs diff --git a/scalardb/src/scalardb/transfer_append.clj b/scalardb/src/scalardb/transfer_append.clj index e3764ef..6b22ae0 100644 --- a/scalardb/src/scalardb/transfer_append.clj +++ b/scalardb/src/scalardb/transfer_append.clj @@ -164,8 +164,9 @@ :age (get-ages results) :num (get-nums results)}) (assoc op :type, :fail, :error "Failed to get all records"))) - :check-tx (if-let [num-committed (scalar/check-transaction-states test - @(:unknown-tx test))] + :check-tx (if-let [num-committed (scalar/check-transaction-states + test + @(:unknown-tx test))] (assoc op :type :ok, :value num-committed) (assoc op :type :fail, :error "Failed to check status"))))