Skip to content

Commit 0ffd02d

Browse files
authored
Merge pull request #3155 from uw-it-aca/qa
Apply error case policy to all services (#3154)
2 parents 7311f67 + 062a2fb commit 0ffd02d

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

myuw/test/util/test_cache.py

+5
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ def test_get_cache_time(self):
101101
self.assertEqual(cache.get_cache_expiration_time(
102102
"mailman", "/uw_list_manager/api/v1/list/", status=500), 60 * 15)
103103

104+
self.assertEqual(cache.get_cache_expiration_time(
105+
"uwidp", "/idp/profile/oidc/keyset", status=404), 60 * 7)
106+
self.assertEqual(cache.get_cache_expiration_time(
107+
"uwidp", "/idp/profile/oidc/keyset", status=500), 60 * 15)
108+
104109

105110
class TestMyUWCache(TestCase):
106111

myuw/util/cache.py

+5-21
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def get_cache_expiration_time(self, service, url, status=None):
2424
if "myplan" == service:
2525
return FIVE_SECONDS
2626

27-
if "sws" == service:
28-
if status and status != 200:
29-
if status >= 500:
30-
return FIFTEEN_MINS
31-
return SEVEN_MINS
27+
if status and status != 200:
28+
if status >= 500:
29+
return FIFTEEN_MINS
30+
return SEVEN_MINS
3231

32+
if "sws" == service:
3333
if re.match(r'^/student/v5/term/', url):
3434
return ONE_DAY
3535

@@ -52,31 +52,15 @@ def get_cache_expiration_time(self, service, url, status=None):
5252
return ONE_DAY
5353

5454
if "gws" == service:
55-
if status and status != 200:
56-
if status >= 500:
57-
return FIFTEEN_MINS
58-
return SEVEN_MINS
5955
return HALF_HOUR
6056

6157
if "pws" == service:
62-
if status and status != 200:
63-
if status >= 500:
64-
return FIFTEEN_MINS
65-
return SEVEN_MINS
6658
return ONE_HOUR
6759

6860
if "uwnetid" == service:
69-
if status and status != 200:
70-
if status >= 500:
71-
return FIFTEEN_MINS
72-
return SEVEN_MINS
7361
return FOUR_HOURS
7462

7563
if "mailman" == service:
76-
if status and status != 200:
77-
if status >= 500:
78-
return FIFTEEN_MINS
79-
return SEVEN_MINS
8064
return ONE_DAY
8165

8266
return FOUR_HOURS

0 commit comments

Comments
 (0)