1. Ludia
  2. Untitled project
  3. dynamodb-mapper


Max Noel  committed 401661c

* transactions: Removed *args from _retry.

  • Participants
  • Parent commits 79b9cdc
  • Branches default

Comments (0)

Files changed (1)

File dynamodb_mapper/transactions.py

View file
         self.datetime = datetime.now(utc_tz)
-    def _retry(self, fn, exc_class, *args):
-        """Call ``fn`` repeatedly with ``*args``, until it stops raising
+    def _retry(self, fn, exc_class):
+        """Call ``fn`` repeatedly, until it stops raising
         ``exc_class`` or it has been called ``MAX_RETRIES`` times (in which case
         :exc:`MaxRetriesExceededError` is raised).
             by fn, means it has failed and should be called again.
             *Any other exception will propagate normally, cancelling the
             auto-retry process.*
-        :param *args: Optional arguments to pass to ``fn``
         tries = 0
         while tries < self.MAX_RETRIES:
             tries += 1
-                fn(*args)
+                fn()
                 # Nothing was raised: we're done !
             except exc_class as e:
             self.status = "running"
-            for transactor in transactors:
-                self._retry(self._apply_and_save_target, ExpectedValueError, *transactor)
+            for getter, setter in transactors:
+                self._retry(
+                    lambda: self._apply_and_save_target(getter, setter),
+                    ExpectedValueError)
             self.status = "done"