From 961ce3809064030d10c6055875111503129dcaad Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Tue, 12 Mar 2024 17:15:14 +0100 Subject: [PATCH] fix interrupt n --- src/thor/costmatrix.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thor/costmatrix.cc b/src/thor/costmatrix.cc index 7c40de2e35..ca75a6b771 100644 --- a/src/thor/costmatrix.cc +++ b/src/thor/costmatrix.cc @@ -166,6 +166,7 @@ bool CostMatrix::SourceToTarget(Api& request, // search from all source locations. Connections between the 2 search // spaces is checked during the forward search. uint32_t n = 0; + uint32_t interrupt_n = 0; while (true) { // First iterate over all targets, then over all sources: we only for sure // check the connection between both trees on the forward search, so reverse @@ -252,10 +253,9 @@ bool CostMatrix::SourceToTarget(Api& request, throw valhalla_exception_t{430}; } // Allow this process to be aborted - if (interrupt_ && (n % kInterruptIterationsInterval) == 0) { + if (interrupt_ && (interrupt_n++ % kInterruptIterationsInterval) == 0) { (*interrupt_)(); } - n++; } // resize/reserve all properties of Matrix on first pass only