diff --git a/backend/copr_backend/sign.py b/backend/copr_backend/sign.py index 6655fb98a..9c65ef3f5 100644 --- a/backend/copr_backend/sign.py +++ b/backend/copr_backend/sign.py @@ -167,7 +167,11 @@ def sign_rpms_in_dir(username, projectname, path, chroot, opts, log): try: get_pubkey(username, projectname, log, opts.sign_domain) except CoprSignNoKeyError: - create_user_keys(username, projectname, opts) + # We don't want to try in indefinitely because that could lead to + # forver stuck builds but we can afford trying to create the key for + # several hours + timeout = 60 * 60 * 10 + create_user_keys(username, projectname, opts, timeout=timeout) errors = [] # tuples (rpm_filepath, exception) for rpm in rpm_list: @@ -185,7 +189,7 @@ def sign_rpms_in_dir(username, projectname, path, chroot, opts, log): .format([err[0] for err in errors])) -def create_user_keys(username, projectname, opts): +def create_user_keys(username, projectname, opts, timeout=None): """ Generate a new key-pair at sign host @@ -204,7 +208,8 @@ def create_user_keys(username, projectname, opts): keygen_url = "http://{}/gen_key".format(opts.keygen_host) query = dict(url=keygen_url, data=data, method="post") try: - request = SafeRequest(log=log) + timeout = timeout or 2 * 60 + request = SafeRequest(log=log, timeout=timeout) response = request.send(**query) except Exception as e: raise CoprKeygenRequestError(