cbuildbot: Set a minimum slave timeout.

Before this CL, we added 20 seconds to the timeout requested for a slave
build by the master build. This is only necessary if the requested
timeout is too small, and causes problems when the timeout is large and
the slave actually times out.
Instead, we now only cap the minimum.

BUG=chromium:711778
TEST=unittests

Change-Id: Ibccee72c17a3aa4a79181560f188cf0dffa5724a
Reviewed-on: https://chromium-review.googlesource.com/487101
Commit-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 5f82fa4..8bc55ae 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -1307,10 +1307,10 @@
           slave_timeout = cidb_handle.GetTimeToDeadline(options.master_build_id)
 
       if slave_timeout is not None:
-        # Cut me some slack. We artificially add a a small time here to the
-        # slave_timeout because '0' is handled specially, and because we don't
-        # want to timeout while trying to set things up.
-        slave_timeout = slave_timeout + 20
+        # We artificially set a minimum slave_timeout because '0' is handled
+        # specially, and because we don't want to timeout while trying to set
+        # things up.
+        slave_timeout = max(slave_timeout, 20)
         if options.timeout == 0 or slave_timeout < options.timeout:
           logging.info('Updating slave build timeout to %d seconds enforced '
                        'by the master', slave_timeout)