Skip to content

Commit 3cd4e15

Browse files
committed
rollback changes
1 parent 74c442e commit 3cd4e15

File tree

3 files changed

+11
-45
lines changed

3 files changed

+11
-45
lines changed

pypi_server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
("Dmitry Orlov", "me@mosquito.su")
1010
]
1111

12-
version_info = (0, 4, '0dev')
12+
version_info = (0, 3, 30)
1313

1414
__version__ = ".".join(map(str, version_info))
1515
__author__ = ", ".join("{0} <{1}>".format(*author) for author in author_info)

pypi_server/handlers/pypi/proxy/client.py

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# encoding: utf-8
22
import hashlib
3-
import json
43
import logging
54
from copy import copy
65
from slimurl import URL
@@ -17,26 +16,6 @@
1716
log = logging.getLogger(__name__)
1817

1918

20-
def async_retrying(number, exceptions=(Exception,)):
21-
def decorator(func):
22-
@coroutine
23-
def wrap(*args, **kwargs):
24-
last_exc = None
25-
for i in range(number):
26-
try:
27-
raise Return((yield func(*args, **kwargs)))
28-
except Return:
29-
raise
30-
except exceptions as e:
31-
log.exception("Error on attempt: %r", i)
32-
last_exc = e
33-
34-
if last_exc:
35-
raise last_exc
36-
return wrap
37-
return decorator
38-
39-
4019
def normalize_package_name(name):
4120
return name.lower().replace("_", "-").replace(".", "-")
4221

@@ -47,20 +26,19 @@ class PYPIClient(object):
4726
THREAD_POOL = None
4827
INDEX = None
4928
XMLRPC = None
50-
RPC_URL = None
5129
LOCK = None
5230

5331
@classmethod
5432
def configure(cls, backend, thread_pool):
5533
cls.CLIENT = AsyncHTTPClient(io_loop=IOLoop.current())
5634
cls.BACKEND = backend
5735
cls.THREAD_POOL = thread_pool
58-
cls.RPC_URL = copy(backend)(path="/pypi")
59-
cls.XMLRPC = ServerProxy(str(cls.RPC_URL))
36+
cls.XMLRPC = ServerProxy(
37+
str(copy(backend)(path="/pypi")),
38+
)
6039
cls.LOCK = Lock()
6140

6241
@classmethod
63-
@async_retrying(5)
6442
@coroutine
6543
@Cache(HOUR, files_cache=True, ignore_self=True)
6644
def packages(cls):
@@ -76,7 +54,6 @@ def packages(cls):
7654
raise Return(index)
7755

7856
@classmethod
79-
@async_retrying(5)
8057
@coroutine
8158
@Cache(4 * HOUR, files_cache=True, ignore_self=True)
8259
def search(cls, names, descriptions, operator="or"):
@@ -85,7 +62,6 @@ def search(cls, names, descriptions, operator="or"):
8562
raise Return(result)
8663

8764
@classmethod
88-
@async_retrying(5)
8965
@coroutine
9066
def exists(cls, name):
9167
try:
@@ -100,7 +76,6 @@ def exists(cls, name):
10076
raise Return(True)
10177

10278
@classmethod
103-
@async_retrying(5)
10479
@coroutine
10580
def find_real_name(cls, name):
10681
if not options.pypi_proxy:
@@ -117,7 +92,6 @@ def find_real_name(cls, name):
11792
raise Return(real_name)
11893

11994
@classmethod
120-
@async_retrying(5)
12195
@coroutine
12296
@Cache(4 * HOUR, files_cache=True, ignore_self=True)
12397
def releases(cls, name):
@@ -145,20 +119,15 @@ def releases(cls, name):
145119
raise Return(set(res))
146120

147121
@classmethod
148-
@async_retrying(5)
149122
@coroutine
150123
@Cache(MONTH, files_cache=True, ignore_self=True)
151124
def release_data(cls, name, version):
152-
url = copy(cls.RPC_URL)
153-
url.path_append(str(name), str(version), 'json')
154-
log.info("Gathering info %s", url)
155-
156-
response = json.loads((yield cls.CLIENT.fetch(str(url))).body)
157-
info = response['info']
158-
files = response['urls']
125+
info, files = yield [
126+
cls.XMLRPC.release_data(str(name), str(version)),
127+
cls.XMLRPC.release_urls(str(name), str(version))
128+
]
159129

160130
download_url = info.get('download_url')
161-
162131
if download_url and not files:
163132
try:
164133
url = URL(download_url)

pypi_server/handlers/pypi/simple/files.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import logging
44

5-
from pypi_server.cache import Cache
5+
from pypi_server.cache import Cache, HOUR
66
from pypi_server.timeit import timeit
77
from tornado.gen import coroutine, Return
88
from tornado.ioloop import IOLoop
@@ -100,11 +100,8 @@ def release_db_save(package, rel, version_info, release_files):
100100
@timeit
101101
@coroutine
102102
def release_fetch(package, rel):
103-
try:
104-
version_info, release_files = yield PYPIClient.release_data(package.name, rel)
105-
raise Return((yield release_db_save(package, rel, version_info, release_files)))
106-
except:
107-
log.exception("Error proccess %r %r", package, rel)
103+
version_info, release_files = yield PYPIClient.release_data(package.name, rel)
104+
raise Return((yield release_db_save(package, rel, version_info, release_files)))
108105

109106

110107
@route(r'/simple/(?P<package>[\w\.\d\-\_]+)/?')

0 commit comments

Comments
 (0)