From 0236c64ace2480abf15127f9f11b52a815adee2d Mon Sep 17 00:00:00 2001 From: Philip Kuryloski Date: Mon, 6 Jul 2020 12:08:23 +0200 Subject: [PATCH] Reduce chances of variable capture in ?awaitMatch Attempt to name all of the variables in the macro such that they are less likely to collide with any existing bindings. --- deps/rabbitmq_ct_helpers/include/rabbit_assert.hrl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/deps/rabbitmq_ct_helpers/include/rabbit_assert.hrl b/deps/rabbitmq_ct_helpers/include/rabbit_assert.hrl index a8213e9977..c3a7e5641b 100644 --- a/deps/rabbitmq_ct_helpers/include/rabbit_assert.hrl +++ b/deps/rabbitmq_ct_helpers/include/rabbit_assert.hrl @@ -1,13 +1,13 @@ -define(awaitMatch(Guard, Expr, Timeout), begin - ((fun Filter(Horizon) -> - R = Expr, - case (R) of - Guard -> R; + ((fun AwaitMatchFilter(AwaitMatchHorizon) -> + AwaitMatchResult = Expr, + case (AwaitMatchResult) of + Guard -> AwaitMatchResult; __V -> case erlang:system_time(millisecond) of - Now when Now < Horizon -> - timer:sleep(min(50, Horizon - Now)), - Filter(Horizon); + AwaitMatchNow when AwaitMatchNow < AwaitMatchHorizon -> + timer:sleep(min(50, AwaitMatchHorizon - AwaitMatchNow)), + AwaitMatchFilter(AwaitMatchHorizon); _ -> erlang:error({awaitMatch, [{module, ?MODULE},