public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/, roverlay/remote/
Date: Sat, 15 Feb 2014 20:35:08 +0000 (UTC)	[thread overview]
Message-ID: <1392496433.5b3a6bae2a01a24042aaf29779b44eb6ea2b5bdd.dywi@gentoo> (raw)

commit:     5b3a6bae2a01a24042aaf29779b44eb6ea2b5bdd
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Feb 15 20:31:44 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Feb 15 20:33:53 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=5b3a6bae

config: add WEBSYNC_TIMEOUT option

This controls the timeout behavior for websync repos (urlopen()).

Other changes:
* RSYNC_BWLIMIT's config key is now REPO.rsync_bwlimit (was RSYNC_BWLIMIT)

---
 roverlay/config/const.py    | 4 ++++
 roverlay/config/entrymap.py | 8 +++++++-
 roverlay/remote/rsync.py    | 2 +-
 roverlay/remote/websync.py  | 9 ++++-----
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 411153a..0933689 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -87,6 +87,10 @@ _CONSTANTS = dict (
       masters                 = [ 'gentoo', ],
    ),
 
+   REPO = dict (
+      websync_timeout = 10,
+   ),
+
    LICENSEMAP = dict (
       use_portdir = True,
    ),

diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index f3396f7..eb24b39 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -420,11 +420,17 @@ CONFIG_ENTRY_MAP = dict (
 
    # this option is used to limit bandwidth usage while running rsync
    rsync_bwlimit = dict (
-      path        = [ 'rsync_bwlimit' ],
+      path        = [ 'REPO', 'rsync_bwlimit' ],
       value_type  = 'int',
       description = "max average rsync bandwidth usage (in kilobytes/second)"
    ),
 
+   websync_timeout = dict (
+      path        = [ 'REPO', 'websync_timeout' ],
+      value_type  = 'int',
+      description = "timeout for websync repo connections (in seconds)"
+   ),
+
    # * alias
    distfiles        = 'distfiles_root',
    repo_config      = 'repo_config_files',

diff --git a/roverlay/remote/rsync.py b/roverlay/remote/rsync.py
index 925dc87..670e714 100644
--- a/roverlay/remote/rsync.py
+++ b/roverlay/remote/rsync.py
@@ -104,7 +104,7 @@ class RsyncRepo ( BasicRepo ):
 
       argv.extend ( DEFAULT_RSYNC_OPTS )
 
-      max_bw = config.get ( 'RSYNC_BWLIMIT', None )
+      max_bw = config.get ( 'REPO.rsync_bwlimit', None )
       if max_bw is not None:
          argv.append ( '--bwlimit=' + str ( max_bw ) )
 

diff --git a/roverlay/remote/websync.py b/roverlay/remote/websync.py
index cbad78d..dbdf0d4 100644
--- a/roverlay/remote/websync.py
+++ b/roverlay/remote/websync.py
@@ -29,7 +29,7 @@ urlopen   = _urllib.urlopen
 URLError  = _urllib_error.URLError
 HTTPError = _urllib_error.HTTPError
 
-from roverlay                  import digest, util
+from roverlay                  import config, digest, util
 from roverlay.remote.basicrepo import BasicRepo
 
 # number of sync retries
@@ -39,9 +39,6 @@ from roverlay.remote.basicrepo import BasicRepo
 #
 MAX_WEBSYNC_RETRY = 3
 
-# timeout for urlopen, in seconds
-URLOPEN_TIMEOUT = 10
-
 VERBOSE = True
 
 # FIXME: websync does not support package deletion
@@ -97,6 +94,8 @@ class WebsyncBase ( BasicRepo ):
             "Unknown/unsupported digest type {}!".format ( digest_type )
          )
 
+      self.timeout = config.get_or_fail ( "REPO.websync_timeout" )
+
       # download 8KiB per block
       self.transfer_blocksize = 8192
    # --- end of __init__ (...) ---
@@ -124,7 +123,7 @@ class WebsyncBase ( BasicRepo ):
 
 
       with contextlib.closing (
-         urlopen ( src_uri, None, URLOPEN_TIMEOUT )
+         urlopen ( src_uri, None, self.timeout )
       ) as webh:
          #web_info = webh.info()
 


                 reply	other threads:[~2014-02-15 20:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392496433.5b3a6bae2a01a24042aaf29779b44eb6ea2b5bdd.dywi@gentoo \
    --to=dywi@mailerd.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox