This repository was archived by the owner on Sep 12, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
depends/docker-registry-core/docker_registry/core Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,11 @@ def wrapper(*args):
65
65
content = args [- 1 ]
66
66
key = args [- 2 ]
67
67
key = cache_key (key )
68
- redis_conn .set (key , content )
68
+ try :
69
+ redis_conn .set (key , content )
70
+ except redis .exceptions .ConnectionError :
71
+ logging .warning ("LRU: Redis connection error" )
72
+
69
73
return f (* args )
70
74
if redis_conn is None :
71
75
return f
@@ -77,13 +81,21 @@ def get(f):
77
81
def wrapper (* args ):
78
82
key = args [- 1 ]
79
83
key = cache_key (key )
80
- content = redis_conn .get (key )
84
+ try :
85
+ content = redis_conn .get (key )
86
+ except redis .exceptions .ConnectionError :
87
+ logging .warning ("LRU: Redis connection error" )
88
+ content = None
89
+
81
90
if content is not None :
82
91
return content
83
92
# Refresh cache
84
93
content = f (* args )
85
94
if content is not None :
86
- redis_conn .set (key , content )
95
+ try :
96
+ redis_conn .set (key , content )
97
+ except redis .exceptions .ConnectionError :
98
+ logging .warning ("LRU: Redis connection error" )
87
99
return content
88
100
if redis_conn is None :
89
101
return f
@@ -95,7 +107,10 @@ def remove(f):
95
107
def wrapper (* args ):
96
108
key = args [- 1 ]
97
109
key = cache_key (key )
98
- redis_conn .delete (key )
110
+ try :
111
+ redis_conn .delete (key )
112
+ except redis .exceptions .ConnectionError :
113
+ logging .warning ("LRU: Redis connection error" )
99
114
return f (* args )
100
115
if redis_conn is None :
101
116
return f
You can’t perform that action at this time.
0 commit comments