fix(prepare): validate expire hours when enable cache (#16949) (#16953)

Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
Chenyu Zhang 2022-06-07 13:21:47 +08:00 committed by GitHub
parent 0dc7a6806c
commit 7ecd4a3f29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -252,6 +252,6 @@ class Cache:
if not self.enabled:
return
if not self.expire_hours.isnumeric():
raise Exception('cache expire hours should be number')
if not self.expire_hours or self.expire_hours <= 0:
raise Exception('cache expire hours should be positive number')
return