Skip to content

Commit 46b07a3

Browse files
committed
[fea] should debug if needed
1 parent a60dec0 commit 46b07a3

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
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", "[email protected]")
1010
]
1111

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

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

pypi_server/cache.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,11 @@ def _expire(self, key, args_key):
236236
if os.path.exists(fname):
237237
os.remove(fname)
238238

239-
self.CACHE.pop(args_key)
239+
self.CACHE.pop(args_key, -1)
240240
log.debug("EXPIRED Cache [%s] %r", key, args_key)
241241

242242

243243
signal.signal(signal.SIGUSR1, Cache.invalidate_all)
244-
signal.signal(signal.SIGUSR2, Cache.invalidate_all)
245244

246245

247246
MINUTE = 60

pypi_server/handlers/index.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
class IndexHander(BaseHandler):
1414
@HTTPCache(600, True, 60)
1515
@coroutine
16-
@Cache(60, ignore_self=True)
1716
def get(self):
1817
vendor_js, vendor_css, application, styles = yield [
1918
self.find(ROOT, 'static/vendor', '.js'),
@@ -32,7 +31,7 @@ def get(self):
3231

3332
@staticmethod
3433
@threaded
35-
@Cache(60)
34+
@Cache(5)
3635
def find(base_dir, path, pattern):
3736
file_list = []
3837

pypi_server/handlers/pypi/package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def get(self, package, version, filename):
8484
self.finish()
8585

8686
@threaded
87-
@Cache(60, ignore_self=True)
87+
@Cache(60, ignore_self=True, files_cache=True)
8888
def find_file(self, package, version, filename):
8989
if not isinstance(package, Package):
9090
package = Package.find(package)

pypi_server/handlers/pypi/simple/packages.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def get(self):
2121

2222
@classmethod
2323
@threaded
24-
@Cache(5)
24+
@Cache(5, files_cache=True, ignore_self=True)
2525
def pkg_list(cls):
2626
return list(Package.select().order_by(Package.lower_name))
2727

@@ -59,6 +59,7 @@ def rpc_list_packages(cls):
5959
return list(map(lambda x: x.name, Package.select()))
6060

6161
@coroutine
62+
@Cache(60, files_cache=True)
6263
def rpc_search(self, query, operator='or'):
6364
results = []
6465

pypi_server/server.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ def on_interrupt(*args):
115115
for sig in (signal.SIGINT, signal.SIGTERM, signal.SIGQUIT):
116116
signal.signal(sig, on_interrupt)
117117

118+
def handle_pdb(sig, frame):
119+
import pdb
120+
pdb.Pdb().set_trace(frame)
121+
122+
signal.signal(signal.SIGUSR2, handle_pdb)
123+
118124
log.debug("Creating application instance")
119125
app = Application(
120126
base_dir=ROOT,

0 commit comments

Comments
 (0)