mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Reworked image sizes cache to work with async cache
refs https://github.com/TryGhost/Toolbox/issues/364 - The caches can be or async nature. Having await syntax allows to support both types - sync and async.
This commit is contained in:
parent
3cb8226100
commit
8b46814700
1 changed files with 3 additions and 3 deletions
|
@ -41,7 +41,7 @@ class CachedImageSizeFromUrl {
|
|||
return;
|
||||
}
|
||||
|
||||
const cachedImageSize = this.cache.get(url);
|
||||
const cachedImageSize = await this.cache.get(url);
|
||||
|
||||
if (cachedImageSize) {
|
||||
debug('Read image from cache:', url);
|
||||
|
@ -50,7 +50,7 @@ class CachedImageSizeFromUrl {
|
|||
} else {
|
||||
try {
|
||||
const res = await this.getImageSizeFromUrl(url);
|
||||
this.cache.set(url, res);
|
||||
await this.cache.set(url, res);
|
||||
|
||||
debug('Cached image:', url);
|
||||
|
||||
|
@ -64,7 +64,7 @@ class CachedImageSizeFromUrl {
|
|||
}
|
||||
|
||||
// in case of error we just attach the url
|
||||
this.cache.set(url, {
|
||||
await this.cache.set(url, {
|
||||
url
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue