* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/, roverlay/remote/
@ 2014-02-15 20:35 André Erdmann
0 siblings, 0 replies; only message in thread
From: André Erdmann @ 2014-02-15 20:35 UTC (permalink / raw
To: gentoo-commits
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()
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-02-15 20:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-15 20:35 [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/, roverlay/remote/ André Erdmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox