testing: let retry's sleeping duration grow faster
authorMichael Wallner <mike@php.net>
Mon, 2 Nov 2020 19:26:20 +0000 (20:26 +0100)
committerMichael Wallner <mike@php.net>
Mon, 2 Nov 2020 19:26:20 +0000 (20:26 +0100)
test/lib/ForkAndExec.cpp
test/lib/Retry.cpp
test/lib/Retry.hpp

index ac30dd0282195e4430019d61901bf9abd1078d0e..5af789f65caa57b725d7c19146c44f64a94bebb7 100644 (file)
@@ -5,6 +5,7 @@
 #include <fcntl.h>
 #include <sys/poll.h>
 #include <unistd.h>
+#include <spawn.h>
 
 #if !HAVE_PIPE2
 static inline int setfl(int fd, int newflags) {
index d8061e314c7d61cda323965ec7bfb81ce61d2476..5764091f578fae2bacfc9608c214d5788c2d06f0 100644 (file)
@@ -15,7 +15,7 @@ bool Retry::operator()() {
       return true;
     }
     this_thread::sleep_for(dur);
-    dur += dur/10;
+    dur += dur / growth;
   }
 
   return false;
index dba843ba79fc34a2e5869e8a194edd9dd24b4a1f..65cbeb5e9462a07fb650d82a6a15170acc3d4019 100644 (file)
@@ -26,6 +26,7 @@ public:
   bool operator()();
 
 private:
+  const unsigned growth = 3;
   unsigned max;
   chrono::milliseconds sleep_for;
   predicate pred;