From 558a211bb9fe7d1907b3a9a7569b490772d08e70 Mon Sep 17 00:00:00 2001
From: Jeremy Fee <jmfee@usgs.gov>
Date: Wed, 20 Jan 2021 15:09:13 -0700
Subject: [PATCH] Combine update_limit check

---
 geomagio/Controller.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/geomagio/Controller.py b/geomagio/Controller.py
index 80195876..8dce1fd7 100644
--- a/geomagio/Controller.py
+++ b/geomagio/Controller.py
@@ -335,9 +335,8 @@ class Controller(object):
             period, oldest to newest.
         """
         # If an update_limit is set, make certain we don't step past it.
-        if update_limit != 0:
-            if update_count >= update_limit:
-                return
+        if update_limit > 0 and update_count >= update_limit:
+            return
         algorithm = self._algorithm
         if algorithm.get_next_starttime() is not None:
             raise AlgorithmException("Stateful algorithms cannot use run_as_update")
-- 
GitLab